diff --git a/widgets/rank_count/conf/info.xml b/widgets/rank_count/conf/info.xml
new file mode 100644
index 000000000..b155ab996
--- /dev/null
+++ b/widgets/rank_count/conf/info.xml
@@ -0,0 +1,73 @@
+
+
+ 글, 댓글 랭킹 출력
+
+ Simulz
+ 글, 댓글 작성 순위를 출력합니다.
+
+
+
+ 제목
+ text
+ 위젯의 제목으로 출력됩니다.
+
+
+ 목록수
+ text
+ 출력될 목록의 수를 정하실 수 있습니다. (기본 5개)
+
+
+ 순위 대상
+ select
+ 대상을 선택하세요.
+
+ 글 작성
+ document
+
+
+ 댓글 작성
+ comment
+
+
+ 파일 첨부
+ attach
+
+
+ 추천 수
+ vote
+
+
+ 조회 수
+ read
+
+
+
+ 관리자
+ select
+ 순위에 관리자를 포함합니다.
+
+ 포함
+ false
+
+
+ 미포함
+ true
+
+
+
+ 그룹 포함
+ text
+ 출력할 회원 그룹명을 입력하세요. 예)준회원,정회원
+
+
+ 그룹 제외
+ text
+ 제외할 회원 그룹명을 입력하세요. 예)관리그룹
+
+
+ 기간(일)
+ text
+ 설정 기간 내의 순위를 출력합니다.
+
+
+
diff --git a/widgets/rank_count/queries/getRankCommentCount.xml b/widgets/rank_count/queries/getRankCommentCount.xml
new file mode 100644
index 000000000..255defc7a
--- /dev/null
+++ b/widgets/rank_count/queries/getRankCommentCount.xml
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/widgets/rank_count/queries/getRankCommentCountWithinGroup.xml b/widgets/rank_count/queries/getRankCommentCountWithinGroup.xml
new file mode 100644
index 000000000..e17f51f70
--- /dev/null
+++ b/widgets/rank_count/queries/getRankCommentCountWithinGroup.xml
@@ -0,0 +1,29 @@
+
\ No newline at end of file
diff --git a/widgets/rank_count/queries/getRankDocumentCount.xml b/widgets/rank_count/queries/getRankDocumentCount.xml
new file mode 100644
index 000000000..bed4d0a34
--- /dev/null
+++ b/widgets/rank_count/queries/getRankDocumentCount.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankDocumentCountWithinGroup.xml b/widgets/rank_count/queries/getRankDocumentCountWithinGroup.xml
new file mode 100644
index 000000000..43f4c2860
--- /dev/null
+++ b/widgets/rank_count/queries/getRankDocumentCountWithinGroup.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankReadedCount.xml b/widgets/rank_count/queries/getRankReadedCount.xml
new file mode 100644
index 000000000..42bed8369
--- /dev/null
+++ b/widgets/rank_count/queries/getRankReadedCount.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankReadedCountWithinGroup.xml b/widgets/rank_count/queries/getRankReadedCountWithinGroup.xml
new file mode 100644
index 000000000..7107106dc
--- /dev/null
+++ b/widgets/rank_count/queries/getRankReadedCountWithinGroup.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankUploadedCount.xml b/widgets/rank_count/queries/getRankUploadedCount.xml
new file mode 100644
index 000000000..c14a1bc27
--- /dev/null
+++ b/widgets/rank_count/queries/getRankUploadedCount.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankUploadedCountWithinGroup.xml b/widgets/rank_count/queries/getRankUploadedCountWithinGroup.xml
new file mode 100644
index 000000000..24613ed2b
--- /dev/null
+++ b/widgets/rank_count/queries/getRankUploadedCountWithinGroup.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankVotedCount.xml b/widgets/rank_count/queries/getRankVotedCount.xml
new file mode 100644
index 000000000..74335b7af
--- /dev/null
+++ b/widgets/rank_count/queries/getRankVotedCount.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/queries/getRankVotedCountWithinGroup.xml b/widgets/rank_count/queries/getRankVotedCountWithinGroup.xml
new file mode 100644
index 000000000..e10fb585d
--- /dev/null
+++ b/widgets/rank_count/queries/getRankVotedCountWithinGroup.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/widgets/rank_count/rank_count.class.php b/widgets/rank_count/rank_count.class.php
new file mode 100644
index 000000000..9ae39c0c3
--- /dev/null
+++ b/widgets/rank_count/rank_count.class.php
@@ -0,0 +1,225 @@
+title;
+ $rankby = $args->rankby;
+ $period = (int)$args->regdate;
+ $list_count = (int)$args->list_count;
+ if(!$list_count) $list_count = 5;
+ $mid_list = explode(",",$args->mid_list);
+ $subject_cut_size = $args->subject_cut_size;
+ if(!$subject_cut_size) $subject_cut_size = 0;
+
+ //그룹 정보를 구해옴 (그룹 포함)
+ $tmp_groups = explode(",",$args->with_group);
+ $count = count($tmp_groups);
+ for($i = 0; $i < $count; $i++) {
+ $group_name = trim($tmp_groups[$i]);
+ if(!$group_name) continue;
+ $target_group[$i] = $group_name;
+ }
+
+ //그룹 정보를 구해옴 (그룹 제외)
+ $tmp_groups = explode(",",$args->without_group);
+ $count = count($tmp_groups);
+ for($i = 0; $i < $count; $i++) {
+ $group_name = trim($tmp_groups[$i]);
+ if(!$group_name) continue;
+ $target_group_without[$i] = $group_name;
+ }
+
+ if($period) {
+ $before_month_month_day = $this->convertDatetoDay( date("n") == 1 ? date("Y") - 1 : date("Y"), date("n") == 1 ? 12 : date("n") - 1);
+
+ $m = date("n");
+ $y = date("Y");
+
+ if(date("j") < $period) {
+ $day = $before_month_month_day + date("j") - $period + 1;
+ $m = $m - 1;
+ if($m < 1) {
+ $m = 12;
+ $y = $y - 1;
+ }
+ } else {
+ $day = date("j") - $period + 1;
+ }
+
+ $widget_info->date_from = $y."-".sprintf("%02d", $m)."-".sprintf("%02d", $day);
+ $widget_info->period = $period;
+ $obj->regdate = $y.sprintf("%02d", $m).sprintf("%02d", $day).date("His");
+ }
+
+ $oMemberModel = &getModel('member');
+ $this->oPointModel = &getModel('point');
+
+ $obj->list_count = $list_count;
+ $obj->is_admin = $args->without_admin == "true" ? "N" : "";
+
+ if(count($target_group) || count($target_group_without)) {
+ // 그룹 목록을 구해옴
+ $group_list = $oMemberModel->getGroups();
+
+ if(count($target_group)) {
+ foreach($group_list as $group_srl => $val) {
+ if(!in_array($val->title, $target_group)) continue;
+ $target_group_srl_list[] = $group_srl;
+ }
+ } else {
+ foreach($group_list as $group_srl => $val) {
+ if(!in_array($val->title, $target_group_without)) continue;
+ $target_group_without_srl_list[] = $group_srl;
+ }
+ }
+
+ // 해당 그룹의 멤버를 구해옴
+ if(count($target_group_srl_list) || count($target_group_without_srl_list)) {
+ if(count($target_group_srl_list)) $obj->selected_group_srl = implode(',',$target_group_srl_list);
+ else $obj->selected_group_without_srl = implode(',',$target_group_without_srl_list);
+
+ if($rankby == "document") $output = executeQuery('widgets.rank_count.getRankDocumentCountWithinGroup', $obj);
+ elseif($rankby == "comment") $output = executeQuery('widgets.rank_count.getRankCommentCountWithinGroup', $obj);
+ elseif($rankby == "attach") $output = executeQuery('widgets.rank_count.getRankUploadedCountWithinGroup', $obj);
+ elseif($rankby == "vote") $output = executeQuery('widgets.rank_count.getRankVotedCountWithinGroup', $obj);
+ elseif($rankby == "read") $output = executeQuery('widgets.rank_count.getRankReadedCountWithinGroup', $obj);
+ }
+ }
+ else {
+ //전체 목록을 구해옴
+ if($rankby == "document") $output = executeQuery('widgets.rank_count.getRankDocumentCount', $obj);
+ elseif($rankby == "comment") $output = executeQuery('widgets.rank_count.getRankCommentCount', $obj);
+ elseif($rankby == "attach") $output = executeQuery('widgets.rank_count.getRankUploadedCount', $obj);
+ elseif($rankby == "vote") $output = executeQuery('widgets.rank_count.getRankVotedCount', $obj);
+ elseif($rankby == "read") $output = executeQuery('widgets.rank_count.getRankReadedCount', $obj);
+ }
+
+ // 오류가 생기면 그냥 무시
+ //if(!$output->toBool()) return;
+
+ // 결과가 있으면 각 문서 객체화를 시킴
+ if(count($output->data)) {
+ foreach($output->data as $key => $val) {
+ $val->point = $this->oPointModel->getPoint($val->member_srl);
+ $val->perlev = $this->point_info($val->member_srl);
+
+ $image_name = $oMemberModel->getImageName($val->member_srl);
+ $image_mark = $oMemberModel->getImageMark($val->member_srl);
+ if($image_name->width) {
+ if($image_mark->height && $image_mark->height > $image_name->height) $top_margin = ($image_mark->height - $image_name->height)/2;
+ else $top_margin = 0;
+ $val->nick_name = sprintf('
', Context::getRequestUri().$image_name->file, $image_name->file, $image_name->file, $image_name->width, $image_name->height, $top_margin);
+ }
+ if($image_mark->width) {
+ $val->nick_name = sprintf('
', Context::getRequestUri().$image_mark->file, $image_mark->file, $image_mark->file, $image_mark->width, $image_mark->height).$val->nick_name;
+ }
+
+ $rank_list[$key] = $val;
+ }
+ } else {
+ $rank_list = array();
+ }
+
+ // 템플릿 파일에서 사용할 변수들을 세팅
+ if(count($mid_list)==1) $widget_info->module_name = $mid_list[0];
+
+ $widget_info->title = $title;
+ $widget_info->list_count = $list_count;
+ $widget_info->data = $rank_list;
+ $widget_info->rankby = $rankby;
+
+ Context::set('widget_info', $widget_info);
+
+ // 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
+ $tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
+ Context::set('colorset', $args->colorset);
+
+ // 템플릿 파일을 지정
+ $tpl_file = 'list';
+
+ // 템플릿 컴파일
+ $oTemplate = &TemplateHandler::getInstance();
+ $output = $oTemplate->compile($tpl_path, $tpl_file);
+ return $output;
+ }
+
+ /**
+ * @brief 포인트 정보 표시
+ **/
+ function point_info($member_srl) {
+ $oModuleModel = &getModel('module');
+ $this->config = $oModuleModel->getModuleConfig('point');
+
+ $point = $this->oPointModel->getPoint($member_srl);
+ $level = $this->oPointModel->getLevel($point, $this->config->level_step);
+
+ $src = sprintf("modules/point/icons/%s/%d.gif", $this->config->level_icon, $level);
+ $info = getimagesize($src);
+ $this->icon_width = $info[0];
+ $this->icon_height = $info[1];
+
+ if($level < $this->config->max_level) {
+ $next_point = $this->config->level_step[$level+1];
+ if($next_point > 0) {
+ $per = (int)($point / $next_point*100);
+ }
+ }
+
+ $code = sprintf('title="%s:%s%s %s, %s:%s/%s" style="background:url(%s) no-repeat left;padding-left:%dpx; height:%dpx"', Context::getLang('point'), $point, $this->config->point_name, $per?"(".$per."%)":"", Context::getLang('level'), $level, $this->config->max_level, Context::getRequestUri().$src, $this->icon_width+2, $this->icon_height);
+ return $code;
+ }
+
+ /**
+ * @brief 날짜 수 계산
+ **/
+ function convertDatetoDay($year, $month) {
+ $numOfLeapYear = 0; // 윤년의 수
+
+ // 전년도까지의 윤년의 수를 구한다.
+ for($i = 0; $i < $year; $i++) {
+ if($this->isLeapYear($i)) $numOfLeapYear++;
+ }
+
+ // 전년도까지의 일 수를 구한다.
+ $toLastYearDaySum = ($year-1) * 365 + $numOfLeapYear;
+
+ // 올해의 현재 월까지의 일수 계산
+ $thisYearDaySum = 0;
+ // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
+ $endOfMonth = array(1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
+
+ for($i = 1; $i < $month; $i++) {
+ $thisYearDaySum += $endOfMonth[$i];
+ }
+
+ // 윤년이고, 2월이 포함되어 있으면 1일을 증가시킨다.
+ if ($month > 2 && $this->isLeapYear($year)) $thisYearDaySum++;
+
+ if($this->isLeapYear($year)) $endOfMonth[2] = 29;
+
+ return $endOfMonth[$month];
+ }
+
+ /**
+ * @brief 윤년 검사
+ **/
+ function isLeapYear($year) {
+ if ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0) return true;
+ else return false;
+ }
+ }
+?>
diff --git a/widgets/rank_count/skins/sz_xe/css/default.css b/widgets/rank_count/skins/sz_xe/css/default.css
new file mode 100644
index 000000000..feb95840c
--- /dev/null
+++ b/widgets/rank_count/skins/sz_xe/css/default.css
@@ -0,0 +1,22 @@
+.szrank_count { width:100%; position:relative; }
+.szrank_count h2 { display:block; height:21px; padding:9px 0 0 9px; color:#000000; font-size:1em;}
+.szrank_count h5{ display:block; height:21px; padding:9px 0 0 9px; margin-top:-15px; color:#000000; font-size:1em;}
+
+.szrank_count .left { cursor:pointer; height:20px; background:url(../images/default/bullet.gif) no-repeat left; padding-left:15px; overflow:hidden; }
+
+.szrank_count .center { text-align:right; padding-left:5px; }
+
+.szrank_count .sz_Box_000{border:solid 0;padding:0;}
+.szrank_count .sz_Box_001{width:100%;border:solid 1px;border-color:#E7E7E7;padding:5px 5px 2px 5px;background-color:#F4F4F4;color:#696969;}
+.szrank_count .sz_Box_002{width:100%;border:solid 1px;border-color:#DDEAA8;padding:5px 5px 2px 5px;background-color:#FBFDF1;color:#99B81A;}
+.szrank_count .sz_Box_003{width:100%;border:solid 1px;border-color:#F9D5D5;padding:5px 5px 2px 5px;background-color:#FEF6F6;color:#D98383;}
+.szrank_count .sz_Box_004{width:100%;border:solid 1px;border-color:#EFDAF4;padding:5px 5px 2px 5px;background-color:#FCF7FD;color:#AF69C0;}
+.szrank_count .sz_Box_005{width:100%;border:solid 1px;border-color:#DCDFF6;padding:5px 5px 2px 5px;background-color:#F6F7FE;color:#7381EA;}
+.szrank_count .sz_Box_006{width:100%;border:solid 1px;border-color:#DAEAEE;padding:5px 5px 2px 5px;background-color:#F0F6F8;color:#619DAC;}
+.szrank_count .sz_Box_007{width:100%;border:solid 1px;border-color:#D5EDDD;padding:5px 5px 2px 5px;background-color:#EFF9F2;color:#6FB587;}
+.szrank_count .sz_Box_008{width:100%;border:solid 1px;border-color:#FFEC15;padding:5px 5px 2px 5px;background-color:#FFFCDF;color:#FF9900;}
+.szrank_count .sz_Box_009{width:100%;border:solid 1px;border-color:#9DD7E8;padding:5px 5px 2px 5px;background-color:#F8FDFF;color:#0A8DBD;}
+
+.szrank_count a {color: #000000; text-decoration:none;}
+.szrank_count a:hover {color: #000000;}
+.szrank_count a:visit {color: #000000;}
\ No newline at end of file
diff --git a/widgets/rank_count/skins/sz_xe/images/default/bullet.gif b/widgets/rank_count/skins/sz_xe/images/default/bullet.gif
new file mode 100644
index 000000000..5a7b98307
Binary files /dev/null and b/widgets/rank_count/skins/sz_xe/images/default/bullet.gif differ
diff --git a/widgets/rank_count/skins/sz_xe/images/default/bulletD0.gif b/widgets/rank_count/skins/sz_xe/images/default/bulletD0.gif
new file mode 100644
index 000000000..e8e17d4c6
Binary files /dev/null and b/widgets/rank_count/skins/sz_xe/images/default/bulletD0.gif differ
diff --git a/widgets/rank_count/skins/sz_xe/images/default/lineNotice.gif b/widgets/rank_count/skins/sz_xe/images/default/lineNotice.gif
new file mode 100644
index 000000000..dbf2c8220
Binary files /dev/null and b/widgets/rank_count/skins/sz_xe/images/default/lineNotice.gif differ
diff --git a/widgets/rank_count/skins/sz_xe/list.html b/widgets/rank_count/skins/sz_xe/list.html
new file mode 100644
index 000000000..bedf48c3c
--- /dev/null
+++ b/widgets/rank_count/skins/sz_xe/list.html
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
{$widget_info->title} Top {$widget_info->list_count}
+
+
(기간: {$widget_info->period}일, {$widget_info->date_from}~)
+
+
+ {@ $no = 1}
+
+
+ | {$no}위. perlev}>{$val->nick_name} |
+ {$val->count}회 |
+
+
+
+ [작성글]
+
+ [작성댓글]
+
+
+ |
+
+ {@ $no++}
+
+
+
+
\ No newline at end of file
diff --git a/widgets/rank_count/skins/sz_xe/skin.xml b/widgets/rank_count/skins/sz_xe/skin.xml
new file mode 100644
index 000000000..bb61aca41
--- /dev/null
+++ b/widgets/rank_count/skins/sz_xe/skin.xml
@@ -0,0 +1,42 @@
+
+
+ Simulz 랭킹 스킨
+
+ Simulz
+
+ Simulz 랭킹 스킨입니다.
+
+
+
+
+ 기본
+
+
+ 회색
+
+
+ 연두
+
+
+ 분홍
+
+
+ 보라
+
+
+ 밝은 파랑
+
+
+ 청록
+
+
+ 초록
+
+
+ 노랑
+
+
+ 파랑
+
+
+