diff --git a/modules/autoinstall/autoinstall.admin.model.php b/modules/autoinstall/autoinstall.admin.model.php index 897160634..0f1c1ec8a 100644 --- a/modules/autoinstall/autoinstall.admin.model.php +++ b/modules/autoinstall/autoinstall.admin.model.php @@ -432,8 +432,8 @@ class autoinstallAdminModel extends autoinstall $_download_server = 'https://download.xpressengine.com/'; $config = new stdClass(); - $config->location_site = $config_info->location_site ? $config_info->location_site : $_location_site; - $config->download_server = $config_info->download_server ? $config_info->download_server : $_download_server; + $config->location_site = ($config_info->location_site ?? null) ?: $_location_site; + $config->download_server = ($config_info->download_server ?? null) ?: $_download_server; return $config; } diff --git a/modules/autoinstall/autoinstall.model.php b/modules/autoinstall/autoinstall.model.php index 3165c913b..cc0031031 100644 --- a/modules/autoinstall/autoinstall.model.php +++ b/modules/autoinstall/autoinstall.model.php @@ -349,13 +349,13 @@ class autoinstallModel extends autoinstall $path = substr($path, 0, strlen($path) - 1); } - if(!$GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path]) + if(empty($GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path])) { $args = new stdClass(); $args->path = $path; $output = executeQuery('autoinstall.getPackageSrlByPath', $args); - $GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path] = $output->data->package_srl; + $GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path] = $output->data->package_srl ?? null; } return $GLOBALS['XE_AUTOINSTALL_PACKAGE_SRL_BY_PATH'][$path]; diff --git a/modules/board/tpl/board_setup_basic.html b/modules/board/tpl/board_setup_basic.html index c959c5e61..3f9917067 100644 --- a/modules/board/tpl/board_setup_basic.html +++ b/modules/board/tpl/board_setup_basic.html @@ -2,6 +2,7 @@ +{@ if(!isset($member_config)) $member_config = MemberModel::getMemberConfig()}
diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php index 48f10ebcd..c00b8dae5 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -82,7 +82,7 @@ class LayoutModel extends Layout foreach($layoutList as $key => $val) { - if($thumbs[$val->layouts]) + if(!empty($thumbs[$val->layouts ?? ''])) { $val->thumbnail = $thumbs[$val->layouts]; continue; @@ -330,7 +330,7 @@ class LayoutModel extends Layout */ function getLayoutPath($layout_name = "", $layout_type = "P") { - $layout_parse = explode('|@|', $layout_name); + $layout_parse = explode('|@|', $layout_name ?? ''); if(count($layout_parse) > 1) { $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; @@ -420,8 +420,8 @@ class LayoutModel extends Layout $b->title = $b->layout; } - $aTitle = strtolower($a->title); - $bTitle = strtolower($b->title); + $aTitle = strtolower($a->title ?? ''); + $bTitle = strtolower($b->title ?? ''); if($aTitle == $bTitle) { @@ -460,7 +460,10 @@ class LayoutModel extends Layout $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; } - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; + if(!empty($GLOBALS[$globalValueKey])) + { + return $GLOBALS[$globalValueKey]; + } $searchedList = FileHandler::readDir($directory); if (!$searchedList) $searchedList = array(); @@ -493,6 +496,12 @@ class LayoutModel extends Layout $xml_file = sprintf('%sskin.xml', $layout_path); } } + else + { + $layout_title = $layout = $layout_srl = null; + $site_srl = 0; + $vars = new stdClass; + } // Get a path of the requested module. Return if not exists. if(!isset($layout_path)) @@ -516,7 +525,7 @@ class LayoutModel extends Layout $layout_info->layout = $layout; $layout_info->path = $layout_path; $layout_info->layout_title = $layout_title; - if(!$layout_info->layout_type) + if(empty($layout_info->layout_type)) { $layout_info->layout_type = $layout_type; } @@ -524,7 +533,7 @@ class LayoutModel extends Layout } // Include the cache file if it is valid and then return $layout_info variable - if(!$layout_srl) + if(empty($layout_srl)) { $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); } @@ -566,7 +575,7 @@ class LayoutModel extends Layout $buff = array(); $buff[] = '$layout_info = new stdClass;'; - $buff[] = sprintf('$layout_info->site_srl = %s;', var_export($site_srl, true)); + $buff[] = sprintf('$layout_info->site_srl = %s;', var_export($site_srl ?? 0, true)); if($xml_obj->version && $xml_obj->attrs->version == '0.2') { @@ -575,17 +584,17 @@ class LayoutModel extends Layout sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); $buff[] = sprintf('$layout_info->layout = %s;', var_export($layout, true)); - $buff[] = sprintf('$layout_info->type = %s;', var_export($xml_obj->attrs->type, true)); + $buff[] = sprintf('$layout_info->type = %s;', var_export($xml_obj->attrs->type ?? null, true)); $buff[] = sprintf('$layout_info->path = %s;', var_export($layout_path, true)); - $buff[] = sprintf('$layout_info->title = %s;', var_export($xml_obj->title->body, true)); - $buff[] = sprintf('$layout_info->description = %s;', var_export($xml_obj->description->body, true)); - $buff[] = sprintf('$layout_info->version = %s;', var_export($xml_obj->version->body, true)); + $buff[] = sprintf('$layout_info->title = %s;', var_export($xml_obj->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->description = %s;', var_export($xml_obj->description->body ?? null, true)); + $buff[] = sprintf('$layout_info->version = %s;', var_export($xml_obj->version->body ?? null, true)); $buff[] = sprintf('$layout_info->date = %s;', var_export($date, true)); - $buff[] = sprintf('$layout_info->homepage = %s;', var_export($xml_obj->link->body, true)); + $buff[] = sprintf('$layout_info->homepage = %s;', var_export($xml_obj->link->body ?? null, true)); $buff[] = sprintf('$layout_info->layout_srl = $layout_srl;'); $buff[] = sprintf('$layout_info->layout_title = $layout_title;'); - $buff[] = sprintf('$layout_info->license = %s;', var_export($xml_obj->license->body, true)); - $buff[] = sprintf('$layout_info->license_link = %s;', var_export($xml_obj->license->attrs->link, true)); + $buff[] = sprintf('$layout_info->license = %s;', var_export($xml_obj->license->body ?? null, true)); + $buff[] = sprintf('$layout_info->license_link = %s;', var_export($xml_obj->license->attrs->link ?? null, true)); $buff[] = sprintf('$layout_info->layout_type = %s;', var_export($layout_type, true)); // Author information @@ -625,11 +634,11 @@ class LayoutModel extends Layout $name = $var->attrs->name; $buff[] = sprintf('$layout_info->extra_var->%s = new stdClass;', $name); - $buff[] = sprintf('$layout_info->extra_var->%s->group = %s;', $name, var_export($group->title->body, true)); - $buff[] = sprintf('$layout_info->extra_var->%s->title = %s;', $name, var_export($var->title->body, true)); - $buff[] = sprintf('$layout_info->extra_var->%s->type = %s;', $name, var_export($var->attrs->type, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->group = %s;', $name, var_export($group->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->title = %s;', $name, var_export($var->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->type = %s;', $name, var_export($var->attrs->type ?? null, true)); $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); - $buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body ?? null, true)); $options = $var->options; if(!$options) continue; @@ -693,17 +702,17 @@ class LayoutModel extends Layout $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); $buff[] = sprintf('$layout_info->layout = %s;', var_export($layout, true)); $buff[] = sprintf('$layout_info->path = %s;', var_export($layout_path, true)); - $buff[] = sprintf('$layout_info->title = %s;', var_export($xml_obj->title->body, true)); - $buff[] = sprintf('$layout_info->description = %s;', var_export($xml_obj->author->description->body, true)); - $buff[] = sprintf('$layout_info->version = %s;', var_export($xml_obj->attrs->version, true)); + $buff[] = sprintf('$layout_info->title = %s;', var_export($xml_obj->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->description = %s;', var_export($xml_obj->author->description->body ?? null, true)); + $buff[] = sprintf('$layout_info->version = %s;', var_export($xml_obj->attrs->version ?? null, true)); $buff[] = sprintf('$layout_info->date = %s;', var_export($date, true)); $buff[] = sprintf('$layout_info->layout_srl = $layout_srl;'); $buff[] = sprintf('$layout_info->layout_title = $layout_title;'); // Author information $buff[] = '$layout_info->author[0] = new stdClass();'; - $buff[] = sprintf('$layout_info->author[0]->name = %s;', var_export($xml_obj->author->name->body, true)); - $buff[] = sprintf('$layout_info->author[0]->email_address = %s;', var_export($xml_obj->author->attrs->email_address, true)); - $buff[] = sprintf('$layout_info->author[0]->homepage = %s;', var_export($xml_obj->author->attrs->link, true)); + $buff[] = sprintf('$layout_info->author[0]->name = %s;', var_export($xml_obj->author->name->body ?? null, true)); + $buff[] = sprintf('$layout_info->author[0]->email_address = %s;', var_export($xml_obj->author->attrs->email_address ?? null, true)); + $buff[] = sprintf('$layout_info->author[0]->homepage = %s;', var_export($xml_obj->author->attrs->link ?? null, true)); // Extra vars (user defined variables to use in a template) $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; @@ -727,11 +736,11 @@ class LayoutModel extends Layout $var = $extra_vars[$i]; $name = $var->attrs->name; $buff[] = sprintf('$layout_info->extra_var->%s = new stdClass();', $name); - $buff[] = sprintf('$layout_info->extra_var->%s->group = %s;', $name, var_export($group->title->body, true)); - $buff[] = sprintf('$layout_info->extra_var->%s->title = %s;', $name, var_export($var->title->body, true)); - $buff[] = sprintf('$layout_info->extra_var->%s->type = %s;', $name, var_export($var->attrs->type, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->group = %s;', $name, var_export($group->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->title = %s;', $name, var_export($var->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->type = %s;', $name, var_export($var->attrs->type ?? null, true)); $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); - $buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body, true)); + $buff[] = sprintf('$layout_info->extra_var->%s->description = %s;', $name, var_export($var->description->body ?? null, true)); $options = $var->options; if(!$options) continue; @@ -762,8 +771,8 @@ class LayoutModel extends Layout if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = %s;', var_export($name, true)); $buff[] = sprintf('$layout_info->menu->%s = new stdClass();', $name); $buff[] = sprintf('$layout_info->menu->%s->name = %s;', $name, var_export($name, true)); - $buff[] = sprintf('$layout_info->menu->%s->title = %s;', $name, var_export($menus[$i]->title->body, true)); - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;', $name, var_export($menus[$i]->maxdepth->body, true)); + $buff[] = sprintf('$layout_info->menu->%s->title = %s;', $name, var_export($menus[$i]->title->body ?? null, true)); + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = %s;', $name, var_export($menus[$i]->maxdepth->body ?? null, true)); $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); @@ -776,7 +785,7 @@ class LayoutModel extends Layout $layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); $header_script = trim($layout_config->header_script); - if($header_script) + if(!empty($header_script)) { $buff[] = sprintf(' $layout_info->header_script = %s; ', var_export($header_script, true)); } diff --git a/modules/menu/menu.admin.model.php b/modules/menu/menu.admin.model.php index b8932a5b4..d70fbf3e3 100644 --- a/modules/menu/menu.admin.model.php +++ b/modules/menu/menu.admin.model.php @@ -48,7 +48,6 @@ class MenuAdminModel extends Menu { // Get information from the DB $args = new stdClass(); - $args->menu_srl = $menu_srl; $output = executeQueryArray('menu.getMenus', $args); if(!$output->data) return; $menus = $output->data; @@ -199,8 +198,8 @@ class MenuAdminModel extends Menu if($moduleInfo->mid == $menuItem->url) { $menuItem->moduleType = $moduleInfo->module; - $menuItem->pageType = $moduleInfo->page_type; - $menuItem->layoutSrl = $moduleInfo->layout_srl; + $menuItem->pageType = $moduleInfo->page_type ?? null; + $menuItem->layoutSrl = $moduleInfo->layout_srl ?? -1; } } } @@ -359,14 +358,14 @@ class MenuAdminModel extends Menu $defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M'); $skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin); $mobileSkinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultMobileSkin, 'm.skins'); - if($defaultMobileSkin === '/USE_RESPONSIVE/' && !$mobileSkinInfo || !$mobileSkinInfo->title) + if($defaultMobileSkin === '/USE_RESPONSIVE/' && !$mobileSkinInfo || empty($mobileSkinInfo->title)) { $mobileSkinInfo = $mobileSkinInfo ?: new stdClass; $mobileSkinInfo->title = lang('use_responsive_pc_skin'); } $module->defaultSkin = new stdClass(); $module->defaultSkin->skin = $defaultSkin; - $module->defaultSkin->title = $skinInfo->title ? $skinInfo->title : $defaultSkin; + $module->defaultSkin->title = isset($skinInfo->title) ? $skinInfo->title : $defaultSkin; $module->defaultMobileSkin = new stdClass(); $module->defaultMobileSkin->skin = $defaultMobileSkin; $module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin; @@ -556,7 +555,7 @@ class MenuAdminModel extends Menu } include($value->php_file); - if(!$menu) + if(empty($menu)) { $menu = new stdClass; $menu->list = array(); @@ -636,6 +635,10 @@ class MenuAdminModel extends Menu { $setupUrl = getNotEncodedUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl); } + else + { + $setupUrl = null; + } if($moduleConfInfo->simple_setup_index_act) { @@ -691,7 +694,7 @@ class MenuAdminModel extends Menu { $menu['module_srl'] = $midInfo->module_srl; $menu['module'] = $midInfo->module; - if($midInfo->page_type) + if(!empty($midInfo->page_type)) { $menu['module_type'] = $midInfo->page_type; } @@ -701,11 +704,11 @@ class MenuAdminModel extends Menu } } - if($moduleInfo->setup_index_act) + if(!empty($moduleInfo->setup_index_act)) { $menu['setup_index_act'] = $moduleInfo->setup_index_act; } - else if($moduleInfo->default_index_act) + elseif(!empty($moduleInfo->default_index_act)) { $menu['setup_index_act'] = $moduleInfo->default_index_act; } diff --git a/modules/module/module.model.php b/modules/module/module.model.php index d8eb18165..cb7fc71de 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -322,13 +322,13 @@ class ModuleModel extends Module } $moduleInfo->designSettings->layout->pcIsDefault = $moduleInfo->layout_srl == -1 ? 1 : 0; - $moduleInfo->designSettings->layout->pc = $layoutInfoPc->title; + $moduleInfo->designSettings->layout->pc = $layoutInfoPc->title ?? null; $moduleInfo->designSettings->layout->mobileIsDefault = $moduleInfo->mlayout_srl == -1 ? 1 : 0; - $moduleInfo->designSettings->layout->mobile = $layoutInfoMobile->title; + $moduleInfo->designSettings->layout->mobile = $layoutInfoMobile->title ?? null; $moduleInfo->designSettings->skin->pcIsDefault = $moduleInfo->is_skin_fix == 'N' ? 1 : 0; - $moduleInfo->designSettings->skin->pc = $skinInfoPc->title; + $moduleInfo->designSettings->skin->pc = $skinInfoPc->title ?? null; $moduleInfo->designSettings->skin->mobileIsDefault = ($moduleInfo->is_mskin_fix == 'N' && $moduleInfo->mskin !== '/USE_RESPONSIVE/') ? 1 : 0; - $moduleInfo->designSettings->skin->mobile = $skinInfoMobile->title; + $moduleInfo->designSettings->skin->mobile = $skinInfoMobile->title ?? null; $module_srl = Rhymix\Framework\Cache::get('site_and_module:module_srl:' . $mid); if($module_srl) @@ -988,7 +988,7 @@ class ModuleModel extends Module { // Read xml file having skin information if(substr($path,-1)!='/') $path .= '/'; - if(!preg_match('/^[a-zA-Z0-9_-]+$/', $skin)) + if(!preg_match('/^[a-zA-Z0-9_-]+$/', $skin ?? '')) { return; } @@ -1983,7 +1983,7 @@ class ModuleModel extends Module { include($designInfoFile); - $skinName = $designInfo->module->{$module_name}->{$target}; + $skinName = $designInfo->module->{$module_name}->{$target} ?? null; } if(!isset($designInfo)) {