Fix warnings in PHP 8.0

This commit is contained in:
Kijin Sung 2021-02-08 21:27:06 +09:00
parent 686699c2ee
commit 588520ff4b
5 changed files with 48 additions and 48 deletions

View file

@ -39,7 +39,7 @@ class boardAdminView extends board {
}
}
if($module_info && $module_info->module != 'board')
if(isset($module_info) && $module_info && $module_info->module != 'board')
{
throw new Rhymix\Framework\Exceptions\InvalidRequest;
}

View file

@ -27,7 +27,7 @@ class fileView extends file
if(!$current_module_srl)
{
// Get information of the current module
$current_module_srl = Context::get('current_module_info')->module_srl;
$current_module_srl = Context::get('current_module_info')->module_srl ?? 0;
if(!$current_module_srl)
{
return;

View file

@ -928,7 +928,7 @@ class moduleModel extends module
$defaultSkinInfo = self::loadSkinInfo($path, $defaultSkinName, $dir);
$useDefault = new stdClass();
$useDefault->title = lang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
$useDefault->title = lang('use_site_default_skin') . ' (' . ($defaultSkinInfo->title ?? null) . ')';
$useDefaultList['/USE_DEFAULT/'] = $useDefault;
}
@ -969,23 +969,23 @@ class moduleModel extends module
{
// skin format v0.2
$date_obj = (object)array('y' => 0, 'm' => 0, 'd' => 0);
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->version = $xml_obj->version->body;
sscanf($xml_obj->date->body ?? null, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->version = $xml_obj->version->body ?? null;
$skin_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$skin_info->homepage = $xml_obj->link->body;
$skin_info->license = $xml_obj->license->body;
$skin_info->license_link = $xml_obj->license->attrs->link;
$skin_info->description = $xml_obj->description->body;
$skin_info->homepage = $xml_obj->link->body ?? null;
$skin_info->license = $xml_obj->license->body ?? null;
$skin_info->license_link = $xml_obj->license->attrs->link ?? null;
$skin_info->description = $xml_obj->description->body ?? null;
if(!is_array($xml_obj->author)) $author_list = array($xml_obj->author);
if(!is_array($xml_obj->author ?? null)) $author_list = array($xml_obj->author);
else $author_list = $xml_obj->author;
foreach($author_list as $author)
{
$author_obj = new stdClass();
$author_obj->name = $author->name->body;
$author_obj->email_address = $author->attrs->email_address;
$author_obj->homepage = $author->attrs->link;
$author_obj->name = $author->name->body ?? null;
$author_obj->email_address = $author->attrs->email_address ?? null;
$author_obj->homepage = $author->attrs->link ?? null;
$skin_info->author[] = $author_obj;
}
// List extra vars
@ -1011,13 +1011,13 @@ class moduleModel extends module
foreach($extra_vars as $key => $val)
{
$obj = new stdClass;
$obj->group = $group->title->body;
$obj->name = $val->attrs->name;
$obj->title = $val->title->body;
$obj->type = $val->attrs->type ?: 'text';
$obj->description = $val->description->body;
$obj->value = $val->attrs->value;
$obj->default = $val->attrs->default;
$obj->group = $group->title->body ?? null;
$obj->name = $val->attrs->name ?? null;
$obj->title = $val->title->body ?? null;
$obj->type = ($val->attrs->type ?? null) ?: 'text';
$obj->description = $val->description->body ?? null;
$obj->value = $val->attrs->value ?? null;
$obj->default = $val->attrs->default ?? null;
if(preg_match('/,|\|@\|/', $obj->value, $delimiter) && $delimiter[0])
{
@ -1036,15 +1036,15 @@ class moduleModel extends module
for($i = 0; $i < $option_count; $i++)
{
$obj->options[$i] = new stdClass();
$obj->options[$i]->title = $val->options[$i]->title->body;
$obj->options[$i]->value = $val->options[$i]->attrs->value;
$obj->options[$i]->title = $val->options[$i]->title->body ?? null;
$obj->options[$i]->value = $val->options[$i]->attrs->value ?? null;
}
}
else
{
$obj->options[0] = new stdClass();
$obj->options[0]->title = $val->options->title->body;
$obj->options[0]->value = $val->options->attrs->value;
$obj->options[0]->title = $val->options->title->body ?? null;
$obj->options[0]->value = $val->options->attrs->value ?? null;
}
$skin_info->extra_vars[] = $obj;
@ -1131,7 +1131,7 @@ class moduleModel extends module
}
// colorset
$colorset = $xml_obj->colorset->color;
$colorset = $xml_obj->colorset->color ?? null;
if($colorset)
{
if(!is_array($colorset)) $colorset = array($colorset);
@ -1156,7 +1156,7 @@ class moduleModel extends module
}
}
// Menu type (settings for layout)
if($xml_obj->menus->menu)
if($xml_obj->menus->menu ?? null)
{
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
@ -1250,7 +1250,7 @@ class moduleModel extends module
{
$args = new stdClass;
$args->module = $module;
$args->module_srl = $module_srl;
$args->module_srl = $module_srl ?: 0;
$output = executeQuery('module.getModulePartConfig', $args);
// Object or Array(compatibility) type

View file

@ -10,7 +10,7 @@
<select name="module_category_srl" id="module_category_srl">
<option value="" selected="selected">{$lang->keep_existing_value}</option>
<option value="0">{$lang->notuse}</option>
<option loop="$module_category => $key, $val" value="{$key}" selected="selected"|cond="$module_info->module_category_srl==$key">{$val->title}</option>
<option loop="$module_category => $key, $val" value="{$key}" selected="selected"|cond="isset($module_info) && $module_info && $module_info->module_category_srl==$key">{$val->title}</option>
</select>
<p class="x_help-inline">{$lang->about_module_category}</p>
</div>
@ -21,7 +21,7 @@
<select name="layout_srl" id="layout_srl">
<option value="" selected="selected">{$lang->keep_existing_value}</option>
<option value="0">{$lang->notuse}</option>
<option loop="$layout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$module_info->layout_srl==$val->layout_srl">{$val->title} ({$val->layout})</option>
<option loop="$layout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="isset($module_info) && $module_info && $module_info->layout_srl==$val->layout_srl">{$val->title} ({$val->layout})</option>
</select>
<p class="x_help-inline">{$lang->about_layout}</p>
</div>
@ -31,7 +31,7 @@
<div class="x_controls">
<select name="skin" id="skin">
<option value="" selected="selected">{$lang->keep_existing_value}</option>
<option loop="$skin_list => $key, $val" value="{$key}" selected="selected"|cond="$module_info->skin==$key">{$val->title}</option>
<option loop="$skin_list => $key, $val" value="{$key}" selected="selected"|cond="isset($module_info) && $module_info && $module_info->skin==$key">{$val->title}</option>
</select>
<p class="x_help-inline">{$lang->about_skin}</p>
</div>
@ -53,7 +53,7 @@
<select name="mlayout_srl" id="mlayout_srl">
<option value="" selected="selected">{$lang->keep_existing_value}</option>
<option value="0">{$lang->notuse}</option>
<option loop="$mlayout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$module_info->mlayout_srl== $val->layout_srl">{$val->title} ({$val->layout})</option>
<option loop="$mlayout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="isset($module_info) && $module_info && $module_info->mlayout_srl== $val->layout_srl">{$val->title} ({$val->layout})</option>
</select>
</div>
</div>
@ -62,14 +62,14 @@
<div class="x_controls">
<select name="mskin" id="mskin">
<option value="" selected="selected">{$lang->keep_existing_value}</option>
<option loop="$mskin_list=> $key, $val" value="{$key}" selected="selected"|cond="$module_info->mskin== $key">{$val->title}</option>
<option loop="$mskin_list=> $key, $val" value="{$key}" selected="selected"|cond="isset($module_info) && $module_info && $module_info->mskin== $key">{$val->title}</option>
</select>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="description">{$lang->description}</label>
<div class="x_controls">
<textarea name="description" id="description" rows="8" cols="42">{htmlspecialchars($module_info->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}</textarea>
<textarea name="description" id="description" rows="8" cols="42">{htmlspecialchars($module_info->description ?? '', ENT_COMPAT | ENT_HTML401, 'UTF-8', false)}</textarea>
<label class="x_inline" for="description_delete"><input name="description_delete" id="description_delete" type="checkbox" value="Y" /> {$lang->cmd_delete}</label>
<p class="x_help-block">{$lang->about_description}</p>
</div>

View file

@ -11,91 +11,91 @@
<div class="x_control-group">
<label for="insert_document" class="x_control-label">{$lang->point_insert_document}</label>
<div class="x_controls">
<input type="number" name="insert_document" id="insert_document" value="{$module_config['insert_document']}" /> {$module_config['point_name']}
<input type="number" name="insert_document" id="insert_document" value="{$module_config['insert_document'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="insert_comment" class="x_control-label">{$lang->point_insert_comment}</label>
<div class="x_controls">
<input type="number" name="insert_comment" id="insert_comment" value="{$module_config['insert_comment']}" /> {$module_config['point_name']}
<input type="number" name="insert_comment" id="insert_comment" value="{$module_config['insert_comment'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="upload_file" class="x_control-label">{$lang->point_upload_file}</label>
<div class="x_controls">
<input type="number" name="upload_file" id="upload_file" value="{$module_config['upload_file']}" /> {$module_config['point_name']}
<input type="number" name="upload_file" id="upload_file" value="{$module_config['upload_file'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="download_file" class="x_control-label">{$lang->point_download_file}</label>
<div class="x_controls">
<input type="number" name="download_file" id="download_file" value="{$module_config['download_file']}" /> {$module_config['point_name']}
<input type="number" name="download_file" id="download_file" value="{$module_config['download_file'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="read_document" class="x_control-label">{$lang->point_read_document}</label>
<div class="x_controls">
<input type="number" name="read_document" id="read_document" value="{$module_config['read_document']}" /> {$module_config['point_name']}
<input type="number" name="read_document" id="read_document" value="{$module_config['read_document'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="voter" class="x_control-label">{$lang->point_voter}</label>
<div class="x_controls">
<input type="number" name="voter" id="voter" value="{$module_config['voter']}" /> {$module_config['point_name']}
<input type="number" name="voter" id="voter" value="{$module_config['voter'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="blamer" class="x_control-label">{$lang->point_blamer}</label>
<div class="x_controls">
<input type="number" name="blamer" id="blamer" value="{$module_config['blamer']}" /> {$module_config['point_name']}
<input type="number" name="blamer" id="blamer" value="{$module_config['blamer'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="voter_comment" class="x_control-label">{$lang->point_voter_comment}</label>
<div class="x_controls">
<input type="number" name="voter_comment" id="voter_comment" value="{$module_config['voter_comment']}" /> {$module_config['point_name']}
<input type="number" name="voter_comment" id="voter_comment" value="{$module_config['voter_comment'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="blamer_comment" class="x_control-label">{$lang->point_blamer_comment}</label>
<div class="x_controls">
<input type="number" name="blamer_comment" id="blamer_comment" value="{$module_config['blamer_comment']}" /> {$module_config['point_name']}
<input type="number" name="blamer_comment" id="blamer_comment" value="{$module_config['blamer_comment'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="download_file_author" class="x_control-label">{$lang->point_download_file_author}</label>
<div class="x_controls">
<input type="number" name="download_file_author" id="download_file_author" value="{$module_config['download_file_author']}" /> {$module_config['point_name']}
<input type="number" name="download_file_author" id="download_file_author" value="{$module_config['download_file_author'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="read_document_author" class="x_control-label">{$lang->point_read_document_author}</label>
<div class="x_controls">
<input type="number" name="read_document_author" id="read_document_author" value="{$module_config['read_document_author']}" /> {$module_config['point_name']}
<input type="number" name="read_document_author" id="read_document_author" value="{$module_config['read_document_author'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="voted" class="x_control-label">{$lang->point_voted}</label>
<div class="x_controls">
<input type="number" name="voted" id="voted" value="{$module_config['voted']}" /> {$module_config['point_name']}
<input type="number" name="voted" id="voted" value="{$module_config['voted'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="blamed" class="x_control-label">{$lang->point_blamed}</label>
<div class="x_controls">
<input type="number" name="blamed" id="blamed" value="{$module_config['blamed']}" /> {$module_config['point_name']}
<input type="number" name="blamed" id="blamed" value="{$module_config['blamed'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="voted_comment" class="x_control-label">{$lang->point_voted_comment}</label>
<div class="x_controls">
<input type="number" name="voted_comment" id="voted_comment" value="{$module_config['voted_comment']}" /> {$module_config['point_name']}
<input type="number" name="voted_comment" id="voted_comment" value="{$module_config['voted_comment'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_control-group">
<label for="blamed_comment" class="x_control-label">{$lang->point_blamed_comment}</label>
<div class="x_controls">
<input type="number" name="blamed_comment" id="blamed_comment" value="{$module_config['blamed_comment']}" /> {$module_config['point_name']}
<input type="number" name="blamed_comment" id="blamed_comment" value="{$module_config['blamed_comment'] ?? null}" /> {$module_config['point_name']}
</div>
</div>
<div class="x_clearfix btnArea">