From 4c2eabe9faaa7b5e1f074e88f5e54611a22979b3 Mon Sep 17 00:00:00 2001 From: zero Date: Thu, 20 Dec 2007 10:13:12 +0000 Subject: [PATCH] =?UTF-8?q?=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EB=A6=AC?= =?UTF-8?q?=EC=85=8B=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80.=20=EA=B8=80/?= =?UTF-8?q?=EB=8C=93=EA=B8=80/=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EC=B2=A8?= =?UTF-8?q?=EB=B6=80=ED=95=9C=20=EC=82=AC=EC=9A=A9=EC=9E=90=EB=A7=8C=20?= =?UTF-8?q?=EB=8C=80=EC=83=81=EC=9D=B4=EA=B3=A0=20=EA=B7=B8=20=EC=99=B8=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EC=9D=80=20=EC=9D=BC=EB=8B=A8=20=EC=A7=80?= =?UTF-8?q?=EC=9B=8C=EC=A7=80=EA=B3=A0=20=EB=82=98=EC=84=9C=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=ED=8C=8C=EC=9D=BC=20=EC=83=9D=EC=84=B1=EC=8B=9C=20?= =?UTF-8?q?=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EC=9E=85=EB=A0=A5=EB=90=A8=20(?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=EC=A0=90=EC=88=98=EB=8A=94?= =?UTF-8?q?=20=EC=9D=B4=EB=95=8C=20=EC=A0=81=EC=9A=A9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3386 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/file/file.controller.php | 2 + modules/member/member.controller.php | 2 + modules/point/conf/module.xml | 3 + modules/point/lang/en.lang.php | 6 + modules/point/lang/es.lang.php | 6 + modules/point/lang/jp.lang.php | 6 + modules/point/lang/ko.lang.php | 6 + modules/point/lang/ru.lang.php | 11 ++ modules/point/lang/zh-CN.lang.php | 6 + modules/point/point.admin.controller.php | 113 +++++++++++++++++++ modules/point/point.controller.php | 5 + modules/point/queries/getCommentPoint.xml | 14 +++ modules/point/queries/getDocumentPoint.xml | 14 +++ modules/point/queries/getFilePoint.xml | 17 +++ modules/point/queries/initMemberPoint.xml | 5 + modules/point/tpl/config.html | 8 ++ modules/point/tpl/js/point_admin.js | 34 +++++- modules/point/tpl/module_config.html | 2 + modules/spamfilter/spamfilter.controller.php | 2 +- 19 files changed, 260 insertions(+), 2 deletions(-) create mode 100644 modules/point/queries/getCommentPoint.xml create mode 100644 modules/point/queries/getDocumentPoint.xml create mode 100644 modules/point/queries/getFilePoint.xml create mode 100644 modules/point/queries/initMemberPoint.xml diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index aa8945cd2..27f1ec49d 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -181,6 +181,8 @@ // trigger 호출 (after) $output = ModuleHandler::triggerCall('file.downloadFile', 'after', $file_obj); + Context::close(); + exit(); } diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 7de316df2..64260fc49 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -106,6 +106,8 @@ if(!$output->toBool()) return $this->stop($output->getMessage()); } + Context::close(); + // 페이지 이동 header("location:./"); exit(); diff --git a/modules/point/conf/module.xml b/modules/point/conf/module.xml index 6e65f087b..7d87c52c9 100644 --- a/modules/point/conf/module.xml +++ b/modules/point/conf/module.xml @@ -12,5 +12,8 @@ + + + diff --git a/modules/point/lang/en.lang.php b/modules/point/lang/en.lang.php index 651f2f995..5810c330c 100644 --- a/modules/point/lang/en.lang.php +++ b/modules/point/lang/en.lang.php @@ -31,6 +31,9 @@ $lang->cmd_exp_calc = '계산'; $lang->cmd_exp_reset = '초기화'; + $lang->cmd_point_recal = '포인트 재계산'; + $lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다'; + $lang->about_module_point = "You can set point for each module and modules which don't have any value will use default point.
All point will be restored on acting reverse."; $lang->point_signup = 'Signup'; @@ -49,4 +52,7 @@ $lang->cmd_point_member_list = 'Member Point List'; $lang->msg_cannot_download = "You don't have enough point to download"; + + $lang->point_recal_message = '포인트 적용중입니다. (%d / %d)'; + $lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다'; ?> diff --git a/modules/point/lang/es.lang.php b/modules/point/lang/es.lang.php index 7d5aee4c8..19dc287a3 100644 --- a/modules/point/lang/es.lang.php +++ b/modules/point/lang/es.lang.php @@ -31,6 +31,9 @@ $lang->cmd_exp_calc = '계산'; $lang->cmd_exp_reset = '초기화'; + $lang->cmd_point_recal = '포인트 재계산'; + $lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다'; + $lang->about_module_point = "Usted puede definir los puntos para cada módulo y los módulos que no tengan ningun valor usarán punto predefinido.
Todos los puntos serán restituidos al actuar en forma contraria."; $lang->point_signup = 'Fecha del'; @@ -49,4 +52,7 @@ $lang->cmd_point_member_list = 'Lista de puntos del usuario'; $lang->msg_cannot_download = "No tiene puntos suficientes para descagar"; + + $lang->point_recal_message = '포인트 적용중입니다. (%d / %d)'; + $lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다'; ?> diff --git a/modules/point/lang/jp.lang.php b/modules/point/lang/jp.lang.php index c52a0e3cc..6b497ac83 100644 --- a/modules/point/lang/jp.lang.php +++ b/modules/point/lang/jp.lang.php @@ -31,6 +31,9 @@ $lang->cmd_exp_calc = '計算'; $lang->cmd_exp_reset = '初期化'; + $lang->cmd_point_recal = '포인트 재계산'; + $lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다'; + $lang->about_module_point = 'モジュール別にポイントを指定することができますが、指定されていないモジュールでは、デフォルトポイントが使用されます。すべてのポイント数は、反対のアクションを行った際には原状復帰されます。'; $lang->point_signup = '加入'; @@ -49,4 +52,7 @@ $lang->cmd_point_member_list = '会員ポイントリスト'; $lang->msg_cannot_download = 'ポイントが不足しているため、ダウンロードできません。'; + + $lang->point_recal_message = '포인트 적용중입니다. (%d / %d)'; + $lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다'; ?> diff --git a/modules/point/lang/ko.lang.php b/modules/point/lang/ko.lang.php index 18f51adb6..1047b7b87 100644 --- a/modules/point/lang/ko.lang.php +++ b/modules/point/lang/ko.lang.php @@ -31,6 +31,9 @@ $lang->cmd_exp_calc = '계산'; $lang->cmd_exp_reset = '초기화'; + $lang->cmd_point_recal = '포인트 재계산'; + $lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다'; + $lang->about_module_point = '모듈별로 포인트를 지정할 수 있으며 지정되지 않은 모듈은 기본 포인트를 이용하게 됩니다
모든 점수는 반대 행동을 하였을 경우 원상복귀 됩니다.'; $lang->point_signup = '가입'; @@ -49,4 +52,7 @@ $lang->cmd_point_member_list = '회원 포인트 목록'; $lang->msg_cannot_download = '포인트가 부족하여 다운로드를 하실 수 없습니다'; + + $lang->point_recal_message = '포인트 적용중입니다. (%d / %d)'; + $lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다'; ?> diff --git a/modules/point/lang/ru.lang.php b/modules/point/lang/ru.lang.php index 1cb952de1..431a693fc 100644 --- a/modules/point/lang/ru.lang.php +++ b/modules/point/lang/ru.lang.php @@ -26,6 +26,14 @@ $lang->disable_download = 'Запретить скачивание'; $lang->about_disable_download = "Это запретит скачивание файлов, когда не хватает достаточного кол-ва поинтов. (За исключением файлов изображений)"; + $lang->level_point_calc = '레벨별 포인트 계산'; + $lang->expression = '레벨 변수 i를 사용하여 자바스크립트 수식을 입력하세요. 예: Math.pow(i, 2) * 90'; + $lang->cmd_exp_calc = '계산'; + $lang->cmd_exp_reset = '초기화'; + + $lang->cmd_point_recal = '포인트 재계산'; + $lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다'; + $lang->about_module_point = "Вы можете установть поинты для каждого модуля, а модули, не имеющие значения будут использовать значение по умолчанию для поинтов.
Все поинты будут восстановлены при обратном действии."; $lang->point_signup = 'Присвоить'; @@ -44,4 +52,7 @@ $lang->cmd_point_member_list = 'Список поинтов пользователей'; $lang->msg_cannot_download = "У Вас нет достаточного количества поитов, чтобы иметь разрешение скачивать файлы."; + + $lang->point_recal_message = '포인트 적용중입니다. (%d / %d)'; + $lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다'; ?> diff --git a/modules/point/lang/zh-CN.lang.php b/modules/point/lang/zh-CN.lang.php index 0bc9c7cc7..9e3a5e5fc 100644 --- a/modules/point/lang/zh-CN.lang.php +++ b/modules/point/lang/zh-CN.lang.php @@ -31,6 +31,9 @@ $lang->cmd_exp_calc = '计算'; $lang->cmd_exp_reset = '初始化'; + $lang->cmd_point_recal = '포인트 재계산'; + $lang->about_cmd_point_recal = '게시글/댓글/첨부파일등을 모두 검사하여 설정된 포인트 설정에 맞게 모든 회원들의 포인트를 재계산합니다'; + $lang->about_module_point = '可以分别对各模块进行积分设置,没有被设置的模块将使用默认值。
所有积分在相反动作下恢复原始值。即:发表新帖后再删除得到的积分为0分。'; $lang->point_signup = '注册'; @@ -49,4 +52,7 @@ $lang->cmd_point_member_list = '会员积分目录'; $lang->msg_cannot_download = '积分不足无法下载!'; + + $lang->point_recal_message = '포인트 적용중입니다. (%d / %d)'; + $lang->point_recal_finished = '포인트 재계산이 모두 완료되었습니다'; ?> diff --git a/modules/point/point.admin.controller.php b/modules/point/point.admin.controller.php index 82821fecc..5d76f01bc 100644 --- a/modules/point/point.admin.controller.php +++ b/modules/point/point.admin.controller.php @@ -149,6 +149,119 @@ return $oPointController->setPoint($member_srl, (int)$point); } + /** + * @brief 전체글/ 댓글/ 첨부파일과 가입정보를 바탕으로 포인트를 재계산함. 단 로그인 점수는 1번만 부여됨 + **/ + function procPointAdminReCal() { + set_time_limit(0); + + // 모듈별 포인트 정보를 가져옴 + $oModuleModel = &getModel('module'); + $config = $oModuleModel->getModuleConfig('point'); + + // 회원의 포인트 저장을 위한 변수 + $member = array(); + + // 게시글 정보를 가져옴 + $output = executeQueryArray('point.getDocumentPoint'); + if(!$output->toBool()) return $output; + + foreach($output->data as $key => $val) { + if($config->module_point[$val->module_srl]->insert_document) $insert_point = $config->module_point[$val->module_srl]->insert_document; + else $insert_point = $config->insert_document; + + if(!$val->member_srl) continue; + $point = $insert_point * $val->count; + $member[$val->member_srl] += $point; + } + $output = null; + + // 댓글 정보를 가져옴 + $output = executeQueryArray('point.getCommentPoint'); + if(!$output->toBool()) return $output; + + foreach($output->data as $key => $val) { + if($config->module_point[$val->module_srl]->insert_comment) $insert_point = $config->module_point[$val->module_srl]->insert_comment; + else $insert_point = $config->insert_comment; + + if(!$val->member_srl) continue; + $point = $insert_point * $val->count; + $member[$val->member_srl] += $point; + } + $output = null; + + // 첨부파일 정보를 가져옴 + $output = executeQueryArray('point.getFilePoint'); + if(!$output->toBool()) return $output; + + foreach($output->data as $key => $val) { + if($config->module_point[$val->module_srl]->upload_file) $insert_point = $config->module_point[$val->module_srl]->upload_file; + else $insert_point = $config->upload_file; + + if(!$val->member_srl) continue; + $point = $insert_point * $val->count; + $member[$val->member_srl] += $point; + } + $output = null; + + // 모든 회원의 포인트를 0으로 세팅 + $output = executeQuery("point.initMemberPoint"); + if(!$output->toBool()) return $output; + + // 임시로 파일 저장 + $f = fopen("./files/cache/pointRecal.txt","w"); + foreach($member as $key => $val) { + $val += (int)$config->signup_point; + fwrite($f, $key.','.$val."\r\n"); + } + fclose($f); + + $this->add('total', count($member)); + $this->add('position', 0); + $this->setMessage( sprintf(Context::getLang('point_recal_message'), 0, $this->get('total')) ); + } + + /** + * @brief 파일로 저장한 회원 포인트를 5000명 단위로 적용 + **/ + function procPointAdminApplyPoint() { + $position = (int)Context::get('position'); + $total = (int)Context::get('total'); + + if(!file_exists('./files/cache/pointRecal.txt')) return new Object(-1, 'msg_invalid_request'); + + $idx = 0; + $f = fopen("./files/cache/pointRecal.txt","r"); + while(!feof($f)) { + $str = trim(fgets($f, 1024)); + $idx ++; + if($idx > $position) { + list($member_srl, $point) = explode(',',$str); + + $args = null; + $args->member_srl = $member_srl; + $args->point = $point; + $output = executeQuery('point.insertPoint',$args); + if($idx%5000==0) break; + } + } + + if(feof($f)) { + @unlink('./files/cache/pointRecal.txt'); + $idx = $total; + + @rename('./files/member_extra_info/point','./files/member_extra_info/point.old'); + FileHandler::removeDir('./files/member_extra_info/point.old'); + } + fclose($f); + + + $this->add('total', $total); + $this->add('position', $idx); + $this->setMessage(sprintf(Context::getLang('point_recal_message'), $idx, $total)); + + } + /** * @brief 캐시파일 저장 **/ diff --git a/modules/point/point.controller.php b/modules/point/point.controller.php index 5a86762a0..2e9a44c9a 100644 --- a/modules/point/point.controller.php +++ b/modules/point/point.controller.php @@ -300,6 +300,10 @@ function setPoint($member_srl, $point) { if($point < 0) $point = 0; + // 설정 정보 가져오기 + $oModuleModel = &getModel('module'); + $config = $oModuleModel->getModuleConfig('point'); + // 변수 설정 $args->member_srl = $member_srl; $args->point = $point; @@ -309,6 +313,7 @@ if($oPointModel->isExistsPoint($member_srl)) { executeQuery("point.updatePoint", $args); } else { + $args->point += (int)$config->signup_point; executeQuery("point.insertPoint", $args); } diff --git a/modules/point/queries/getCommentPoint.xml b/modules/point/queries/getCommentPoint.xml new file mode 100644 index 000000000..a1ce7f7ab --- /dev/null +++ b/modules/point/queries/getCommentPoint.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/modules/point/queries/getDocumentPoint.xml b/modules/point/queries/getDocumentPoint.xml new file mode 100644 index 000000000..a7d23f147 --- /dev/null +++ b/modules/point/queries/getDocumentPoint.xml @@ -0,0 +1,14 @@ + + +
+ + + + + + + + + + + diff --git a/modules/point/queries/getFilePoint.xml b/modules/point/queries/getFilePoint.xml new file mode 100644 index 000000000..05232eaff --- /dev/null +++ b/modules/point/queries/getFilePoint.xml @@ -0,0 +1,17 @@ + + +
+ + + + + + + + + + + + + + diff --git a/modules/point/queries/initMemberPoint.xml b/modules/point/queries/initMemberPoint.xml new file mode 100644 index 000000000..fabe4b149 --- /dev/null +++ b/modules/point/queries/initMemberPoint.xml @@ -0,0 +1,5 @@ + + +
+ + diff --git a/modules/point/tpl/config.html b/modules/point/tpl/config.html index d1962c2e6..e0cfee35b 100644 --- a/modules/point/tpl/config.html +++ b/modules/point/tpl/config.html @@ -8,6 +8,14 @@ + + + + + @@ -21,6 +22,7 @@ +
{$lang->cmd_point_recal} + +

{$lang->about_cmd_point_recal}

+
+
{$lang->max_level} diff --git a/modules/point/tpl/js/point_admin.js b/modules/point/tpl/js/point_admin.js index 5bca56f1e..a74acafb0 100644 --- a/modules/point/tpl/js/point_admin.js +++ b/modules/point/tpl/js/point_admin.js @@ -16,4 +16,36 @@ function exp_calc (form, reset) { point = eval("fo_obj.level_step_" + i) point.value = eval(exp.value); } -} \ No newline at end of file +} + +/** + * @brief 포인트를 전부 체크하여 재계산하는 action 호출 + **/ +function doPointRecal() { + + var params = new Array(); + var response_tags = new Array('error','message','total', 'position'); + + exec_xml('point','procPointAdminReCal',params, completePointRecal, response_tags); +} + +function completePointRecal(ret_obj) { + var total = ret_obj['total']; + var message = ret_obj['message']; + var position = ret_obj['position']; + + if(position == total) { + xInnerHtml('pointReCal', message); + alert(message); + location.reload(); + } else { + xInnerHtml('pointReCal', message); + + var params = new Array(); + params['position'] = position; + params['total'] = total; + var response_tags = new Array('error','message','total', 'position'); + + exec_xml('point','procPointAdminApplyPoint',params, completePointRecal, response_tags); + } +} diff --git a/modules/point/tpl/module_config.html b/modules/point/tpl/module_config.html index af4b8c581..e5d241067 100644 --- a/modules/point/tpl/module_config.html +++ b/modules/point/tpl/module_config.html @@ -11,6 +11,7 @@ {$lang->point_download_file}
{$val->browser_title} ({$val->mid})
{$config->point_name}
diff --git a/modules/spamfilter/spamfilter.controller.php b/modules/spamfilter/spamfilter.controller.php index c1311fa00..d463dceeb 100644 --- a/modules/spamfilter/spamfilter.controller.php +++ b/modules/spamfilter/spamfilter.controller.php @@ -16,7 +16,7 @@ /** * @brief 글 작성시 글 작성 시간 체크 및 금지 ip/단어 처리 루틴 **/ - function triggerinsertDocument(&$obj) { + function triggerInsertDocument(&$obj) { // 로그인 여부, 로그인 정보, 권한 유무 체크 $is_logged = Context::get('is_logged'); $logged_info = Context::get('logged_info');