From 5a66bcab8227e930c49e32c461780c12a275d24b Mon Sep 17 00:00:00 2001 From: BJRambo Date: Wed, 22 Jul 2020 23:44:49 +0900 Subject: [PATCH] =?UTF-8?q?Fix=20#1362=20=ED=8F=AC=EC=9D=B8=ED=8A=B8?= =?UTF-8?q?=EB=AA=A8=EB=93=88=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8D=94=EB=9D=BC=EB=8F=84=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=EA=B0=92=EC=9D=80=20=EC=A0=80=EC=9E=A5=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 변경점이 많습니다. 크게 변경한 점은 없고 if($args->able_module == 'Y') 안에서 동작하는 $config 변수들을 전부 if문 밖으로 빼내서 설정을 저장하도록 하였습니다. 설정 저장을 테스트 해봤으며 큰 문제 없어 보입니다. --- modules/point/point.admin.controller.php | 209 ++++++++++++----------- 1 file changed, 105 insertions(+), 104 deletions(-) diff --git a/modules/point/point.admin.controller.php b/modules/point/point.admin.controller.php index c88d96d0e..a2cd3488b 100644 --- a/modules/point/point.admin.controller.php +++ b/modules/point/point.admin.controller.php @@ -37,110 +37,6 @@ class pointAdminController extends point //module IO config is on $config->able_module = 'Y'; - - // Check the point name - $config->point_name = $args->point_name; - if(!$config->point_name) - { - $config->point_name = 'point'; - } - - // Specify the default points - $config->signup_point = (int)$args->signup_point; - $config->login_point = (int)$args->login_point; - $config->insert_document = (int)$args->insert_document; - $config->insert_comment = (int)$args->insert_comment; - $config->upload_file = (int)$args->upload_file; - $config->download_file = (int)$args->download_file; - $config->read_document = (int)$args->read_document; - $config->voter = (int)$args->voter; - $config->blamer = (int)$args->blamer; - $config->voted = (int)$args->voted; - $config->blamed = (int)$args->blamed; - $config->download_file_author = (int)$args->download_file_author; - $config->read_document_author = (int)$args->read_document_author; - $config->voter_comment = (int)$args->voter_comment; - $config->blamer_comment = (int)$args->blamer_comment; - $config->voted_comment = (int)$args->voted_comment; - $config->blamed_comment = (int)$args->blamed_comment; - - // Specify notice exceptions - $config->read_document_except_notice = ($args->read_document_except_notice === 'Y'); - $config->read_document_author_except_notice = ($args->read_document_author_except_notice === 'Y'); - - // Specify revert on delete - $config->insert_document_revert_on_delete = ($args->insert_document_revert_on_delete === 'Y'); - $config->insert_comment_revert_on_delete = ($args->insert_comment_revert_on_delete === 'Y'); - $config->upload_file_revert_on_delete = ($args->upload_file_revert_on_delete === 'Y'); - - // Specify time limits - $config->insert_comment_limit = $config->no_point_date = (int)$args->insert_comment_limit; - $config->read_document_limit = (int)$args->read_document_limit; - $config->voter_limit = (int)$args->voter_limit; - $config->blamer_limit = (int)$args->blamer_limit; - $config->voted_limit = (int)$args->voted_limit; - $config->blamed_limit = (int)$args->blamed_limit; - $config->read_document_author_limit = (int)$args->read_document_author_limit; - $config->voter_comment_limit = (int)$args->voter_comment_limit; - $config->blamer_comment_limit = (int)$args->blamer_comment_limit; - $config->voted_comment_limit = (int)$args->voted_comment_limit; - $config->blamed_comment_limit = (int)$args->blamed_comment_limit; - - // The highest level - $config->max_level = $args->max_level; - if($config->max_level>1000) $config->max_level = 1000; - if($config->max_level<1) $config->max_level = 1; - - // Set the level icon - $config->level_icon = $args->level_icon; - - // Check if downloads are not allowed - $config->disable_download = ($args->disable_download === 'Y') ? 'Y' : 'N'; - - // Check if reading a document is not allowed - $config->disable_read_document = ($args->disable_read_document === 'Y') ? 'Y' : 'N'; - $config->disable_read_document_except_robots = ($args->disable_read_document_except_robots === 'Y') ? 'Y' : 'N'; - - $oMemberModel = getModel('member'); - $group_list = $oMemberModel->getGroups(); - $config->point_group = array(); - - // Per-level group configurations - foreach($group_list as $group) - { - // Admin group should not be connected to point. - if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; - - $group_srl = $group->group_srl; - - if(isset($args->{'point_group_'.$group_srl})) - { - //if group level is higher than max level, change to max level - if($args->{'point_group_'.$group_srl} > $args->max_level) - { - $args->{'point_group_'.$group_srl} = $args->max_level; - } - - //if group level is lower than 1, change to 1 - if($args->{'point_group_'.$group_srl} && $args->{'point_group_'.$group_srl} < 1) - { - $args->{'point_group_'.$group_srl} = 1; - } - $config->point_group[$group_srl] = $args->{'point_group_'.$group_srl}; - } - } - - $config->group_reset = $args->group_reset; - $config->group_ratchet = $args->group_ratchet; - // Per-level point configurations - unset($config->level_step); - for($i=1;$i<=$config->max_level;$i++) - { - $key = "level_step_".$i; - $config->level_step[$i] = (int)$args->{$key}; - } - // A function to calculate per-level points - $config->expression = $args->expression; } else { @@ -150,6 +46,111 @@ class pointAdminController extends point // Delete Triggers $oModuleController->deleteModuleTriggers('point'); } + + // Check the point name + $config->point_name = $args->point_name; + if(!$config->point_name) + { + $config->point_name = 'point'; + } + + // Specify the default points + $config->signup_point = (int)$args->signup_point; + $config->login_point = (int)$args->login_point; + $config->insert_document = (int)$args->insert_document; + $config->insert_comment = (int)$args->insert_comment; + $config->upload_file = (int)$args->upload_file; + $config->download_file = (int)$args->download_file; + $config->read_document = (int)$args->read_document; + $config->voter = (int)$args->voter; + $config->blamer = (int)$args->blamer; + $config->voted = (int)$args->voted; + $config->blamed = (int)$args->blamed; + $config->download_file_author = (int)$args->download_file_author; + $config->read_document_author = (int)$args->read_document_author; + $config->voter_comment = (int)$args->voter_comment; + $config->blamer_comment = (int)$args->blamer_comment; + $config->voted_comment = (int)$args->voted_comment; + $config->blamed_comment = (int)$args->blamed_comment; + + // Specify notice exceptions + $config->read_document_except_notice = ($args->read_document_except_notice === 'Y'); + $config->read_document_author_except_notice = ($args->read_document_author_except_notice === 'Y'); + + // Specify revert on delete + $config->insert_document_revert_on_delete = ($args->insert_document_revert_on_delete === 'Y'); + $config->insert_comment_revert_on_delete = ($args->insert_comment_revert_on_delete === 'Y'); + $config->upload_file_revert_on_delete = ($args->upload_file_revert_on_delete === 'Y'); + + // Specify time limits + $config->insert_comment_limit = $config->no_point_date = (int)$args->insert_comment_limit; + $config->read_document_limit = (int)$args->read_document_limit; + $config->voter_limit = (int)$args->voter_limit; + $config->blamer_limit = (int)$args->blamer_limit; + $config->voted_limit = (int)$args->voted_limit; + $config->blamed_limit = (int)$args->blamed_limit; + $config->read_document_author_limit = (int)$args->read_document_author_limit; + $config->voter_comment_limit = (int)$args->voter_comment_limit; + $config->blamer_comment_limit = (int)$args->blamer_comment_limit; + $config->voted_comment_limit = (int)$args->voted_comment_limit; + $config->blamed_comment_limit = (int)$args->blamed_comment_limit; + + // The highest level + $config->max_level = $args->max_level; + if($config->max_level>1000) $config->max_level = 1000; + if($config->max_level<1) $config->max_level = 1; + + // Set the level icon + $config->level_icon = $args->level_icon; + + // Check if downloads are not allowed + $config->disable_download = ($args->disable_download === 'Y') ? 'Y' : 'N'; + + // Check if reading a document is not allowed + $config->disable_read_document = ($args->disable_read_document === 'Y') ? 'Y' : 'N'; + $config->disable_read_document_except_robots = ($args->disable_read_document_except_robots === 'Y') ? 'Y' : 'N'; + + $oMemberModel = getModel('member'); + $group_list = $oMemberModel->getGroups(); + $config->point_group = array(); + + // Per-level group configurations + foreach($group_list as $group) + { + // Admin group should not be connected to point. + if($group->is_admin == 'Y' || $group->is_default == 'Y') continue; + + $group_srl = $group->group_srl; + + if(isset($args->{'point_group_'.$group_srl})) + { + //if group level is higher than max level, change to max level + if($args->{'point_group_'.$group_srl} > $args->max_level) + { + $args->{'point_group_'.$group_srl} = $args->max_level; + } + + //if group level is lower than 1, change to 1 + if($args->{'point_group_'.$group_srl} && $args->{'point_group_'.$group_srl} < 1) + { + $args->{'point_group_'.$group_srl} = 1; + } + $config->point_group[$group_srl] = $args->{'point_group_'.$group_srl}; + } + } + + $config->group_reset = $args->group_reset; + $config->group_ratchet = $args->group_ratchet; + // Per-level point configurations + unset($config->level_step); + for($i=1;$i<=$config->max_level;$i++) + { + $key = "level_step_".$i; + $config->level_step[$i] = (int)$args->{$key}; + } + // A function to calculate per-level points + $config->expression = $args->expression; + // Save $oModuleController->insertModuleConfig('point', $config);