mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Clean up insertModule() and handle null values in some important fields
This commit is contained in:
parent
2d7d66efca
commit
e821955129
1 changed files with 23 additions and 30 deletions
|
|
@ -344,33 +344,26 @@ class moduleController extends module
|
||||||
*/
|
*/
|
||||||
function insertModule($args)
|
function insertModule($args)
|
||||||
{
|
{
|
||||||
if(isset($args->isMenuCreate))
|
|
||||||
{
|
|
||||||
$isMenuCreate = $args->isMenuCreate;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$isMenuCreate = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$output = $this->arrangeModuleInfo($args, $extra_vars);
|
$output = $this->arrangeModuleInfo($args, $extra_vars);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether the module name already exists
|
// Check whether the module name already exists
|
||||||
if(ModuleModel::isIDExists($args->mid)) return new BaseObject(-1, 'msg_module_name_exists');
|
if(ModuleModel::isIDExists($args->mid))
|
||||||
|
{
|
||||||
|
return new BaseObject(-1, 'msg_module_name_exists');
|
||||||
|
}
|
||||||
|
|
||||||
// begin transaction
|
// Fill default values
|
||||||
$oDB = &DB::getInstance();
|
if (empty($args->module_srl))
|
||||||
$oDB->begin();
|
{
|
||||||
// Get colorset from the skin information
|
$args->module_srl = getNextSequence();
|
||||||
$module_path = ModuleHandler::getModulePath($args->module);
|
}
|
||||||
$skin_info = ModuleModel::loadSkinInfo($module_path, $args->skin);
|
$args->browser_title = escape(strip_tags($args->browser_title ?? ''), false);
|
||||||
$skin_vars = new stdClass();
|
$args->description = isset($args->description) ? escape($args->description, false) : null;
|
||||||
$skin_vars->colorset = $skin_info->colorset[0]->name;
|
if(!isset($args->skin) || $args->skin == '/USE_DEFAULT/')
|
||||||
// Arrange variables and then execute a query
|
|
||||||
if(!$args->module_srl) $args->module_srl = getNextSequence();
|
|
||||||
|
|
||||||
// default value
|
|
||||||
if($args->skin == '/USE_DEFAULT/')
|
|
||||||
{
|
{
|
||||||
$args->is_skin_fix = 'N';
|
$args->is_skin_fix = 'N';
|
||||||
}
|
}
|
||||||
|
|
@ -385,8 +378,7 @@ class moduleController extends module
|
||||||
$args->is_skin_fix = 'Y';
|
$args->is_skin_fix = 'Y';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!isset($args->mskin) || $args->mskin == '/USE_DEFAULT/' || $args->mskin == '/USE_RESPONSIVE/')
|
||||||
if($args->mskin == '/USE_DEFAULT/' || $args->mskin == '/USE_RESPONSIVE/')
|
|
||||||
{
|
{
|
||||||
$args->is_mskin_fix = 'N';
|
$args->is_mskin_fix = 'N';
|
||||||
}
|
}
|
||||||
|
|
@ -402,11 +394,12 @@ class moduleController extends module
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($output);
|
// begin transaction
|
||||||
|
$oDB = DB::getInstance();
|
||||||
|
$oDB->begin();
|
||||||
|
|
||||||
$args->browser_title = strip_tags($args->browser_title);
|
$isMenuCreate = $args->isMenuCreate ?? true;
|
||||||
|
if($isMenuCreate)
|
||||||
if($isMenuCreate === TRUE)
|
|
||||||
{
|
{
|
||||||
$menuArgs = new stdClass;
|
$menuArgs = new stdClass;
|
||||||
$menuArgs->menu_srl = $args->menu_srl;
|
$menuArgs->menu_srl = $args->menu_srl;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue