git-svn-id: http://xe-core.googlecode.com/svn/trunk@1213 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-18 05:37:23 +00:00
parent 713bbfe3d2
commit 7ae6882c5c
16 changed files with 109 additions and 254 deletions

View file

@ -293,7 +293,9 @@
case 'like' : case 'like' :
$value = '%'.$value.'%'; $value = '%'.$value.'%';
break; break;
case 'in' :
return "'".$value."'";
break;
} }
return "'".$this->addQuotes($value)."'"; return "'".$this->addQuotes($value)."'";

View file

@ -34,26 +34,30 @@
* @brief 플러그인 객체를 return * @brief 플러그인 객체를 return
**/ **/
function getObject($plugin) { function getObject($plugin) {
// 일단 플러그인의 위치를 찾음 if(!$GLOBALS['_xe_loaded_plugins_'][$plugin]) {
$oPluginModel = &getModel('plugin'); // 일단 플러그인의 위치를 찾음
$path = $oPluginModel->getPluginPath($plugin); $oPluginModel = &getModel('plugin');
$path = $oPluginModel->getPluginPath($plugin);
// 플러그인 클래스 파일을 찾고 없으면 에러 출력 (html output) // 플러그인 클래스 파일을 찾고 없으면 에러 출력 (html output)
$class_file = sprintf('%s%s.class.php', $path, $plugin); $class_file = sprintf('%s%s.class.php', $path, $plugin);
if(!file_exists($class_file)) return sprintf(Context::getLang('msg_plugin_is_not_exists'), $plugin); if(!file_exists($class_file)) return sprintf(Context::getLang('msg_plugin_is_not_exists'), $plugin);
// 플러그인 클래스를 include // 플러그인 클래스를 include
require_once($class_file); require_once($class_file);
// 객체 생성 // 객체 생성
$eval_str = sprintf('$oPlugin = new %s();', $plugin); $eval_str = sprintf('$oPlugin = new %s();', $plugin);
@eval($eval_str); @eval($eval_str);
if(!is_object($oPlugin)) return sprintf(Context::getLang('msg_plugin_object_is_null'), $plugin); if(!is_object($oPlugin)) return sprintf(Context::getLang('msg_plugin_object_is_null'), $plugin);
if(!method_exists($oPlugin, 'proc')) return sprintf(Context::getLang('msg_plugin_proc_is_null'), $plugin);
$oPlugin->plugin_path = $path; if(!method_exists($oPlugin, 'proc')) return sprintf(Context::getLang('msg_plugin_proc_is_null'), $plugin);
return $oPlugin; $oPlugin->plugin_path = $path;
$GLOBALS['_xe_loaded_plugins_'][$plugin] = $oPlugin;
}
return $GLOBALS['_xe_loaded_plugins_'][$plugin];
} }
} }

View file

@ -39,6 +39,9 @@
<!-- 로그인 플러그인 --> <!-- 로그인 플러그인 -->
<img src="./common/tpl/images/blank.gif" class="zbxe_plugin_output" plugin="login_info" skin="default" colorset="normal" style="width:100px;height:100px;"/> <img src="./common/tpl/images/blank.gif" class="zbxe_plugin_output" plugin="login_info" skin="default" colorset="normal" style="width:100px;height:100px;"/>
<!-- 카운터 플러그인 -->
<img src="./common/tpl/images/blank.gif" class="zbxe_plugin_output" plugin="counter_status" skin="default" colorset="normal" style="width:100px;height:100px;"/>
<!-- 블로그 메뉴 출력 --> <!-- 블로그 메뉴 출력 -->
<div id="menu"></div> <div id="menu"></div>

View file

@ -17,8 +17,8 @@
$oCounterController = &getController('counter'); $oCounterController = &getController('counter');
// 00000000000000 일자로 기록될 전체 방문 기록 row 추가 // 00000000 일자로 기록될 전체 방문 기록 row 추가
$oCounterController->insertTodayStatus('00000000000000'); $oCounterController->insertTodayStatus('000000');
// 오늘자 row입력 // 오늘자 row입력
$oCounterController->insertTodayStatus(); $oCounterController->insertTodayStatus();

View file

@ -54,16 +54,18 @@
* @brief unique visitor 등록 * @brief unique visitor 등록
**/ **/
function insertUniqueVisitor() { function insertUniqueVisitor() {
$args->regdate = date("Ymd000000"); $args->regdate = date("Ymd");
return executeQuery('counter.updateCounterUnique', $args); executeQuery('counter.updateCounterUnique', $args);
executeQuery('counter.updateTotalCounterUnique');
} }
/** /**
* @brief pageview 등록 * @brief pageview 등록
**/ **/
function insertPageView() { function insertPageView() {
$args->regdate = date("Ymd000000"); $args->regdate = date("Ymd");
return executeQuery('counter.updateCounterPageview', $args); executeQuery('counter.updateCounterPageview', $args);
executeQuery('counter.updateTotalCounterPageview');
} }
/** /**
@ -71,7 +73,7 @@
**/ **/
function insertTodayStatus($regdate = 0) { function insertTodayStatus($regdate = 0) {
if($regdate) $args->regdate = $regdate; if($regdate) $args->regdate = $regdate;
else $args->regdate = date("Ymd000000"); else $args->regdate = date("Ymd");
executeQuery('counter.insertTodayStatus', $args); executeQuery('counter.insertTodayStatus', $args);
// 로그 등록 // 로그 등록

View file

@ -26,7 +26,7 @@
* @brief 오늘자 카운터 현황 row 있는지 체크 * @brief 오늘자 카운터 현황 row 있는지 체크
**/ **/
function isInsertedTodayStatus() { function isInsertedTodayStatus() {
$args->regdate = date("Ymd000000"); $args->regdate = date("Ymd");
$output = executeQuery('counter.getTodayStatus', $args); $output = executeQuery('counter.getTodayStatus', $args);
return $output->data->count?true:false; return $output->data->count?true:false;
} }
@ -38,18 +38,26 @@
// 여러개의 날자 로그를 가져올 경우 // 여러개의 날자 로그를 가져올 경우
if(is_array($regdate)) { if(is_array($regdate)) {
$date_count = count($regdate); $date_count = count($regdate);
for($i=0;$i<$date_count;$i++) { $args->regdate = implode(',',$regdate);
if(strlen($regdate[$i])==8) $regdate[$i] = $regdate[$i].'000000';
$args->regdate = "'".implode("','",$regdate)."'";
}
// 단일 날자의 로그를 가져올 경우 // 단일 날자의 로그를 가져올 경우
} else { } else {
if(strlen($regdate)==8) $regdate = $regdate.'000000'; if(strlen($regdate)==8) $regdate = $regdate;
$args->regdate = $regdate; $args->regdate = $regdate;
} }
$output = executeQuery('counter.getCounterStatus', $args); $output = executeQuery('counter.getCounterStatus', $args);
return $output->data; $status = $output->data;
if(!is_array($regdate)) return $status;
if(!is_array($status)) $status = array($status);
unset($output);
foreach($status as $key => $val) {
$output[substr($val->regdate,0,8)] = $val;
}
return $output;
} }
} }

View file

@ -6,7 +6,6 @@
<column name="pageview" default="plus(1)" /> <column name="pageview" default="plus(1)" />
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="regdate" notnull="notnull" default="00000000000000" /> <condition operation="equal" column="regdate" var="regdate" notnull="notnull" />
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="or" />
</conditions> </conditions>
</query> </query>

View file

@ -7,7 +7,6 @@
<column name="pageview" default="plus(1)" /> <column name="pageview" default="plus(1)" />
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="regdate" notnull="notnull" default="00000000000000" /> <condition operation="equal" column="regdate" var="regdate" notnull="notnull" />
<condition operation="equal" column="regdate" var="regdate" notnull="notnull" pipe="or" />
</conditions> </conditions>
</query> </query>

View file

@ -0,0 +1,11 @@
<query id="updateTotalCounterPageview" action="update">
<tables>
<table name="counter_status" />
</tables>
<columns>
<column name="pageview" default="plus(1)" />
</columns>
<conditions>
<condition operation="equal" column="regdate" default="00000000" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,12 @@
<query id="updateTotalCounterUnique" action="update">
<tables>
<table name="counter_status" />
</tables>
<columns>
<column name="unique_visitor" default="plus(1)" />
<column name="pageview" default="plus(1)" />
</columns>
<conditions>
<condition operation="in" column="regdate" default="00000000" notnull="notnull" />
</conditions>
</query>

View file

@ -1,5 +1,5 @@
<table name="counter_status"> <table name="counter_status">
<column name="regdate" type="date" primary_key="primary_key" /> <column name="regdate" type="number" size="11" notnull="notnull" primary_key="primary_key" />
<column name="unique_visitor" type="number" size="11" default="0" /> <column name="unique_visitor" type="number" size="11" default="0" />
<column name="pageview" type="number" size="11" default="0" /> <column name="pageview" type="number" size="11" default="0" />
</table> </table>

View file

@ -14,6 +14,16 @@
* 결과를 만든후 print가 아니라 return 해주어야 한다 * 결과를 만든후 print가 아니라 return 해주어야 한다
**/ **/
function proc($args) { function proc($args) {
// 전체, 어제, 오늘 접속 현황을 가져옴
$oCounterModel = &getModel('counter');
$output = $oCounterModel->getStatus(array('00000000', date('Ymd', time()-60*60*24), date('Ymd')));
foreach($output as $key => $val) {
if(!$key) Context::set('total_counter', $val);
elseif($key == date("Ymd")) Context::set('today_counter', $val);
else Context::set('yesterday_counter', $val);
}
// 변수 설정 // 변수 설정
Context::set('style', $args->style); Context::set('style', $args->style);
@ -28,7 +38,5 @@
$oTemplate = new TemplateHandler(); $oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file); return $oTemplate->compile($tpl_path, $tpl_file);
} }
} }
?> ?>

View file

@ -1,83 +1,22 @@
<!-- colorset의 값에 따라 css 파일을 import 한다 --> <!--@if($colorset == "normal")-->
<!--@if($colorset=="normal"||!$colorset)-->
<!--%import("normal/style.css")--> <!--%import("normal/style.css")-->
<!--@end--> <!--@end-->
<!-- 로그인 사용자일 경우 로그인 정보를 출력 --> <div class="counter_plugin">
<!--@if($logged_info)-->
<!--%import("./filter/logout.xml")-->
<div class="login_plugin">
<!-- 닉네임 + 로그아웃 --> <!--@if($total_counter)-->
<div class="top_box"> <div class="header">Total</div>
<div class="logout"> <div class="footer">{$total_counter->unique_visitor} / {$total_counter->pageview}</div>
<a href="#" onclick="location.href='{getUrl('act','dispMemberLogout')}';return false;">{$lang->cmd_logout}</a> <!--@end-->
</div>
<div class="nick_name">
<div class="member_{$logged_info->member_srl}">{$logged_info->nick_name}</div>
</div>
</div>
<div class="info_box"> <!--@if($today_counter)-->
<div class="header">Today</div>
<div class="footer">{$today_counter->unique_visitor} / {$today_counter->pageview}</div>
<!--@end-->
<!-- 정보 수정 링크 --> <!--@if($yesterday_counter)-->
<div class="member_info"> <div class="header">Yesterday</div>
<a href="#" onclick="location.href='{getUrl('act','dispMemberInfo')}';return false;">{$lang->cmd_view_member_info}</a> <div class="footer">{$yesterday_counter->unique_visitor} / {$yesterday_counter->pageview}</div>
</div> <!--@end-->
<div class="friend_list"> </div>
<a href="#" onclick="popopen('{getUrl('','module','member','act','dispMemberFriend')}','sendMessage');return false;">{$lang->cmd_view_friend}</a>
</div>
<div class="message_box">
<a href="#" onclick="location.href='{getUrl('act','dispMemberMessages')}';return false;">{$lang->cmd_view_message_box}</a>
</div>
<!-- 관리자일 경우 관리자 링크 -->
<!--@if($logged_info->is_admin=="Y")-->
<div class="link_admin">
<a href="#" onclick="winopen('./?module=admin');return false;">{$lang->cmd_management}</a>
</div>
<!--@end-->
<!-- 최종 록그인 시간 -->
<div class="last_login">
{$lang->last_login} : {zDate($logged_info->last_login, "Y-m-d H:i")}
</div>
</div>
</div>
<!-- 비로그인 사용자일 경우 로그인 폼을 출력 -->
<!--@else-->
<!--%import("./filter/login.xml")-->
<!--%import("./js/login.js")-->
<div class="login_plugin">
<form action="./" method="get" onsubmit="return procFilter(this, plugin_login)" id="fo_login_plugin">
<div class="login_box">
<div class="header">{$lang->user_id}</div>
<div class="body">
<div><input type="text" name="user_id" id="login_form_user_id" class="input" /></div>
<div>
<input type="checkbox" name="remember_user_id" id="chk_remember_user_id" value="Y" />
<label for="chk_remember_user_id">{$lang->remember_user_id}</label>
</div>
</div>
<div class="header">{$lang->password}</div>
<div class="body"><input type="password" name="password" class="input" /></div>
</div>
<div class="button_area">
<input type="submit" value="{$lang->cmd_login}" class="submit_button" />
<input type="button" value="{$lang->cmd_signup}" class="signup_button" onclick="location.href='{getUrl('act','dispMemberSignUpForm')}';return false;" />
</div>
</form>
<script type="text/javascript">
xAddEventListener(window, "load", function(){ doFocusUserId("fo_login_plugin"); });
</script>
</div>
<!--@end-->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

View file

@ -1,151 +1,19 @@
.login_plugin { .counter_plugin {
border:3px solid #DDDDDD; border:3px solid #DDDDDD;
padding:6px; padding:6px;
height:80px;
margin-bottom:10px; margin-bottom:10px;
color:#999999;
font-family:tahoma;
font-size:8pt;
} }
.login_plugin .top_box { .counter_plugin .header {
height:22px;
border-bottom:2px dotted #DDDDDD;
overflow:hidden;
margin-bottom:5px;
}
.login_plugin .top_box .nick_name {
font-weight:bold; font-weight:bold;
float:left; float:left;
color:#555555; width:50px;
margin-right:10px;
} }
.login_plugin .top_box .logout { .counter_plugin .footer {
float:right; clear:right;
}
.login_plugin .top_box .logout A {
text-decoration:none;
color:#737CF5;
}
.login_plugin .top_box .logout A:hover {
font-weight:bold;
letter-spacing:-1px;
color:#151F9E;
}
.login_plugin .info_box {
clear:both;
color:#555555;
}
.login_plugin .info_box A:link {
text-decoration:none;
color:#555555;
}
.login_plugin .info_box A:visited {
text-decoration:none;
color:#555555;
}
.login_plugin .info_box A:hover {
text-decoration:none;
font-weight:bold;
letter-spacing:-1px;
color:#555555;
}
.login_plugin .info_box div {
padding-left:15px;
margin:0px 0px 4px 0px;
}
.login_plugin .info_box .member_info {
background:url("../images/icon_profile.gif") no-repeat left;
float:left;
width:90px;
}
.login_plugin .info_box .friend_list {
background:url("../images/icon_friend_list.gif") no-repeat left;
float:left;
}
.login_plugin .info_box .message_box {
background:url("../images/icon_message_box.gif") no-repeat left;
float:left;
width:90px;
}
.login_plugin .info_box .link_admin {
background:url("../images/icon_key.gif") no-repeat left;
float:left;
}
.login_plugin .info_box .link_admin A {
color:#cd0000;
}
.login_plugin .info_box .last_login {
clear:left;
background:url("../images/icon_last_login.gif") no-repeat left;
padding-left:15px;
margin-bottom:4px;
}
.login_plugin .login_box {
height:40px;
}
.login_plugin .header {
float:left;
clear:left;
width:80px;
margin-bottom:5px;
font-weight:bold;
color:#555555;
}
.login_plugin .body {
float:left;
width:100px;
margin-bottom:5px;
}
.login_plugin .body .input {
width:90px;
height:13px;
border:1px solid #AAAAAA;
color:#555555;
}
.login_plugin .body label {
cursor:pointer;
}
.login_plugin .button_area {
clear:both;
height:20px;
margin-top:5px;
text-align:center;
}
.login_plugin .button_area .submit_button {
width:80px;
height:18px;
border:1px solid #AAAAAA;
background-color:#555555;
color:#FFFFFF;
font-weight:bold;
}
.login_plugin .button_area .signup_button {
width:80px;
height:18px;
border:1px solid #555555;
background-color:#FFFFFF;
color:#000000;
font-weight:bold;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B