This commit is contained in:
shim
2023-04-17 11:06:08 +09:00
parent d0b393aa97
commit 76264e09ad
4686 changed files with 552713 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
## Copyright and license
Copyright 2020 Redblock, Inc.
Licensed under the [RBL](https://kimsq.com/p/rbl) License

View File

@@ -0,0 +1,25 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
$cut_modules = '';
foreach($module_members as $mds)
{
$cut_modules .= '['.$mds.']';
}
$_tmpdfile = $g['path_var'].'site/'.$r.'/'.$m.'.var.php';
$fp = fopen($_tmpdfile,'w');
fwrite($fp, "<?php\n");
fwrite($fp, "\$d['ntfc']['sec'] = \"".trim($sec)."\";\n");
fwrite($fp, "\$d['ntfc']['num'] = \"".trim($num)."\";\n");
fwrite($fp, "\$d['ntfc']['cut_modules'] = \"".trim($cut_modules)."\";\n");
fwrite($fp, "?>");
fclose($fp);
@chmod($_tmpdfile,0707);
getLink('reload','parent.','반영 되었습니다.','');
?>

View File

@@ -0,0 +1,56 @@
<?php
if(!defined('__KIMS__')) exit;
require_once $g['path_core'].'function/sys.class.php';
$sort = $_GET['sort']; // 정렬 기준
$orderby = $_GET['orderby']; // 정렬순서
$recnum = $_GET['recnum']; // 출력갯수
$page = $_GET['page']; // 처음엔 무조건 1
$where = 'mbruid='.$my['uid']; // 출력 조건
$g['memberVarForSite'] = $g['path_var'].'site/'.$r.'/member.var.php'; // 사이트 회원모듈 변수파일
$_varfile = file_exists($g['memberVarForSite']) ? $g['memberVarForSite'] : $g['path_module'].$m.'/var/var.php';
include_once $_varfile; // 변수파일 인클루드
if ($g['mobile']&&$_SESSION['pcmode']!='Y') {
$theme = $d['member']['theme_mobile'];
} else {
$theme = $d['member']['theme_main'];
}
$result=array();
$result['error'] = false;
$RCD = getDbArray($table['s_notice'],$where,'*',$sort,$orderby,$recnum,$page);
$html='';
$m = 'member';
$markup_file = 'noti_list'; // 기본 마크업 페이지 전달 (테마 내부 _html/noti_list.html)
$skin=new skin($markup_file);
while($R = db_fetch_array($RCD)){
$SM1=$R['mbruid']?getDbData($table['s_mbrdata'],'memberuid='.$R['mbruid'],'name,nic'):'';
$SM2=$R['frommbr']?getDbData($table['s_mbrdata'],'memberuid='.$R['frommbr'],'memberuid,name,nic'):'';
$MD = getDbData($table['s_module'],"id='".$R['frommodule']."'",'icon');
$avatar =$R['frommbr']?getAvatarSrc($SM2['memberuid'],'120'):'/_core/images/touch/homescreen-192x192.png';
$TMPL['from'] = $SM2[$_HS['nametype']];
$TMPL['icon'] = $MD['icon'];
$TMPL['avatar'] = $avatar;
$TMPL['uid'] = $R["uid"];
$TMPL['title'] = $R['title'];
$TMPL['message'] = getStrCut($R['message'],150,'');
$TMPL['datetime'] = getDateFormat($R['d_regis'],'c');
$TMPL['check_read'] = $R['d_read']?'':'table-view-active';
$TMPL['check_new'] = getNew($R['d_regis'],24)?'':' d-none';
$html.=$skin->make();
}
$result['content'] = $html;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,25 @@
<?php
if(!defined('__KIMS__')) exit;
$result=array();
$result['error'] = false;
$uid = $_POST['uid'];
$d_read = $date['totime'];
$R = getUidData($table['s_notice'],$uid);
$result['referer'] = $R['referer'];
$result['button'] = $R['button'];
$result['d_regis'] = getDateFormat($R['d_regis'],'Y.m.d H:i');
$result['title'] = $R['title'];
$result['message'] = getContents($R['message'],'TEXT');
echo json_encode($result);
// 읽음처리
if ($my['num_notice'] > 0 && !$R['d_read']) {
getDbUpdate($table['s_mbrdata'],'num_notice='.$my['num_notice'].'-1','memberuid='.$my['uid']);
}
getDbUpdate($table['s_notice'],'d_read='.$d_read,'uid='.$uid);
exit;
?>

View File

@@ -0,0 +1,72 @@
<?php
if(!defined('__KIMS__')) exit;
require_once $g['path_core'].'function/sys.class.php';
$sort=$_GET['sort']?$_GET['sort']:'uid';
$orderby=$_GET['orderby']?$_GET['orderby']:'desc';
$recnum=$_GET['recnum']?$_GET['recnum']:15;// 추출갯수
$page=$_GET['page']?$_GET['page']:1;
$callMod=$_GET['callMod']; //안읽은 상태
$sqlque = 'mbruid='.$my['uid'];
if ($callMod=='unread') $sqlque .= ' and d_read=""';
$RCD = getDbArray($table['s_notice'],$sqlque,'*',$sort,$orderby,$recnum,$page);
$NUM = getDbRows($table['s_notice'],$sqlque);
$TPG = getTotalPage($NUM,$recnum);
$g['memberVarForSite'] = $g['path_var'].'site/'.$r.'/member.var.php'; // 사이트 회원모듈 변수파일
$_varfile = file_exists($g['memberVarForSite']) ? $g['memberVarForSite'] : $g['path_module'].'member/var/var.php';
include_once $_varfile; // 변수파일 인클루드
if ($g['mobile']&&$_SESSION['pcmode']!='Y') {
$theme = $d['member']['theme_mobile'];
} else {
$theme = $d['member']['theme_main'];
}
$result=array();
$result['error'] = false;
$html='';
$m = 'member';
$markup_file = 'noti_list'; // 기본 마크업 페이지 전달 (테마 내부 _html/noti_list.html)
$skin=new skin($markup_file);
while($R = db_fetch_array($RCD)){
$SM1=$R['mbruid']?getDbData($table['s_mbrdata'],'memberuid='.$R['mbruid'],'name,nic'):array();
$SM2=$R['frommbr']?getDbData($table['s_mbrdata'],'memberuid='.$R['frommbr'],'memberuid,name,nic'):array();
$MD = getDbData($table['s_module'],"id='".$R['frommodule']."'",'icon');
$avatar =$R['frommbr']?getAvatarSrc($SM2['memberuid'],'120'):'/_core/images/touch/homescreen-192x192.png';
$TMPL['from'] = $SM2[$_HS['nametype']];
$TMPL['icon'] = $MD['icon'];
$TMPL['avatar'] = $avatar;
$TMPL['uid'] = $R["uid"];
$TMPL['title'] = $R['title'];
$TMPL['message'] = getStrCut($R['message'],150,'');
$TMPL['datetime'] = getDateFormat($R['d_regis'],'c');
$TMPL['referer'] = $R['referer'];
$TMPL['check_read'] = $R['d_read']?'bg-light bg-faded':'';
$TMPL['check_new'] = getNew($R['d_regis'],24)?'':' d-none';
$html.=$skin->make();
}
if(!$NUM) {
// 모바일/데스크탑 분기
if ($g['mobile'] && $_SESSION['pcmode'] != 'Y') {
$html.='<li class="p-5 text-xs-center text-muted d-flex align-items-center justify-content-center" style="height: calc(100vh - 10.5rem);">새 알림이 없습니다.</li>';
} else {
$html.='<span class="list-group-item text-center p-5 small text-muted">새 알림이 없습니다.</span>';
}
}
$result['num'] = !$NUM?'':$NUM;
$result['tpg'] = $TPG;
$result['content'] = $html;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,36 @@
<?php
$g['notiVarForSite'] = $g['path_var'].'site/'.$r.'/notification.var.php';
include_once file_exists($g['notiVarForSite']) ? $g['notiVarForSite'] : $g['path_module'].$m.'/var/var.php';
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>PUSH</title>
<?php getImport('jquery','jquery.min','3.3.1','js')?>
</head>
<body>
<script>
function putNotiNum() {
<?php if($my['num_notice']):?>
parent.$('[data-role="noti-status"]').text(<?php echo $my['num_notice']?>)
<?php if ($browtitle): ?>
parent.document.title = '(<?php echo $my['num_notice']?>) <?php echo $browtitle?>'
<?php endif?>
<?php else: ?>
parent.document.title = '<?php echo $browtitle?>'
parent.$('[data-role="noti-status"]').text('')
<?php endif?>
setTimeout("location.reload();",<?php echo $d['ntfc']['sec']?>000);
}
putNotiNum();
</script>
</body>
</html>
<?php
exit;
?>

View File

@@ -0,0 +1,13 @@
<?php
if(!defined('__KIMS__')) exit;
if (!$my['uid']) exit;
$result=array();
$result['error'] = false;
$num_notice = !$my['num_notice']?'':$my['num_notice'];
$result['num'] = $num_notice;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,27 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
if ($deltype == 'all')
{
getDbDelete($table['s_notice'],'mbruid='.$my['uid']);
getDbUpdate($table['s_mbrdata'],'num_notice=0','memberuid='.$my['uid']);
}
else if ($deltype == 'read')
{
getDbDelete($table['s_notice'],'mbruid='.$my['uid']." and d_read<>''");
getDbUpdate($table['s_mbrdata'],'num_notice='.getDbRows($table['s_notice'],'mbruid='.$my['uid']." and d_read=''"),'memberuid='.$my['uid']);
}
else {
// 관리자모드 선택삭제
foreach($noti_members as $val)
{
$NT=getDbData($table['s_notice'],"uid='".$val."'",'uid,mbruid,d_read');
getDbDelete($table['s_notice'],"uid='".$NT['uid']."'");
if(!$NT['d_read']) getDbUpdate($table['s_mbrdata'],'num_notice='.getDbRows($table['s_notice'],'mbruid='.$NT['mbruid']." and d_read=''"),'memberuid='.$NT['mbruid']);
}
}
setrawcookie('result_noti_main', rawurlencode('알림이 삭제 되었습니다.|success')); // 처리여부 cookie 저장
getLink('reload','parent.','','');
?>

View File

@@ -0,0 +1,90 @@
<?php
if(!defined('__KIMS__')) exit;
if (!$my['uid']) getLink('','','정상적인 접근이 아닙니다.','');
if ($deltype == 'delete_all')
{
getDbDelete($table['s_notice'],'mbruid='.$my['uid']);
getDbUpdate($table['s_mbrdata'],'num_notice=0','memberuid='.$my['uid']);
}
else if ($deltype == 'delete_read')
{
getDbDelete($table['s_notice'],'mbruid='.$my['uid']." and d_read<>''");
getDbUpdate($table['s_mbrdata'],'num_notice='.getDbRows($table['s_notice'],'mbruid='.$my['uid']." and d_read=''"),'memberuid='.$my['uid']);
}
else if ($deltype == 'delete_select') {
foreach($noti_members as $val)
{
$exp = explode('|',$val);
getDbDelete($table['s_notice'],"uid='".$exp[0]."' and mbruid=".$my['uid']);
}
getDbUpdate($table['s_mbrdata'],'num_notice='.getDbRows($table['s_notice'],'mbruid='.$my['uid']." and d_read=''"),'memberuid='.$my['uid']);
}
else if ($deltype == 'cut_member')
{
$NT_DATA = explode('|',$my['noticeconf']);
$nt_members = $NT_DATA[4];
foreach($noti_members as $val)
{
$exp = explode('|',$val);
if (!$exp[1]) continue;
if ($exp[1] == $my['uid'])
{
$isMe = true;
continue;
}
if (!strstr($nt_members,'['.$exp[1].']')) $nt_members = '['.$exp[1].']' . $nt_members;
}
$NT_STRING = $NT_DATA[0].'|'.$NT_DATA[1].'|'.$NT_DATA[2].'|'.$NT_DATA[3].'|'.$nt_members.'|'.$NT_DATA[5].'|';
getDbUpdate($table['s_mbrdata'],"noticeconf='".$NT_STRING."'",'memberuid='.$my['uid']);
}
else if ($deltype == 'cut_module')
{
$NT_DATA = explode('|',$my['noticeconf']);
$nt_modules = $NT_DATA[3];
foreach($noti_members as $val)
{
$exp = explode('|',$val);
if ($exp[1] == $my['uid'])
{
$isMe = true;
continue;
}
if (!strstr($nt_modules,'['.$exp[2].']')) $nt_modules = '['.$exp[2].']' . $nt_modules;
}
$NT_STRING = $NT_DATA[0].'|'.$NT_DATA[1].'|'.$NT_DATA[2].'|'.$nt_modules.'|'.$NT_DATA[4].'|'.$NT_DATA[5].'|';
getDbUpdate($table['s_mbrdata'],"noticeconf='".$NT_STRING."'",'memberuid='.$my['uid']);
}
else if ($deltype == 'off_module')
{
$NT_DATA = explode('|',$my['noticeconf']);
$nt_modules = $NT_DATA[3];
if (!strstr($nt_modules,'['.$module_id.']')) $nt_modules = '['.$module_id.']' . $nt_modules;
$NT_STRING = $NT_DATA[0].'|'.$NT_DATA[1].'|'.$NT_DATA[2].'|'.$nt_modules.'|'.$NT_DATA[4].'|'.$NT_DATA[5].'|';
getDbUpdate($table['s_mbrdata'],"noticeconf='".$NT_STRING."'",'memberuid='.$my['uid']);
if ($mobile) {
echo '<script type="text/javascript">';
echo 'parent.$.notify({message: "알림이 해제되었습니다."},{type: "default"});';
echo '</script>';
exit();
} else {
setrawcookie('member_settings_result', rawurlencode('알림이 해제되었습니다.'));
}
}
if ($deltype=='cut_member'||$deltype=='cut_module')
{
if ($isMe) {
setrawcookie('member_noti_result', rawurlencode('자기 자신은 차단할 수 없습니다.|danger'));
} else {
setrawcookie('member_noti_result', rawurlencode('차단 되었습니다.'));
}
}
else {
setrawcookie('member_noti_result', rawurlencode('처리 되었습니다.')); // 처리여부 cookie 저장
}
getLink('reload','parent.','','');
?>

View File

@@ -0,0 +1,92 @@
<?php
if(!defined('__KIMS__')) exit;
if(!$my['uid']) exit;
$g['notiVarForSite'] = $g['path_var'].'site/'.$r.'/notification.var.php';
include_once file_exists($g['notiVarForSite']) ? $g['notiVarForSite'] : $g['path_module'].$m.'/var/var.php';
if($noticedata=='Y'):
$NT_DATA = explode('|',$my['noticeconf']);
?>
[RESULT:
<?php if($NT_DATA[2] && !$_SESSION['sh_notify_auto_del']):?>
<div class="alert alert-danger alert-dismissible" style="margin:0;border:0;border-radius:0;" role="alert">
<button type="button" class="close" data-dismiss="alert" onclick="sessionSetting('sh_notify_auto_del','1','','');"><span aria-hidden="true">&times;</span></button>
<strong><a href="<?php echo $g['s']?>/?r=<?php echo $r?>&iframe=Y&system=popup.notification&callMod=config" class="alert-link">Warning!</a></strong> 자동삭제 설정되어 있습니다.
</div>
<?php endif?>
<?php $RCD = getDbArray($table['s_notice'],'mbruid='.$my['uid'].($callMod=='view'?'':" and d_read=''"),'*','uid','desc',($recnum?$recnum:10),$p)?>
<?php $_i=0;while($R=db_fetch_array($RCD)):?>
<?php if (!$R['d_read']) getDbUpdate($table['s_notice'],"d_read='".$date['totime']."'","uid='".$R['uid']."'")?>
<?php $M=getDbData($table['s_mbrdata'],'memberuid='.$R['frommbr'],'*')?>
<div class="list-group-item">
<div class="media">
<?php if($R['frommbr']):?>
<a href="#." class="mr-3" id='_rb-popover-from-<?php echo $_i?>' data-placement="right" data-popover="popover" data-content="<div id='rb-popover-from-<?php echo $_i?>'><script>getPopover('member','<?php echo $R['mbruid']?>','rb-popover-from-<?php echo $_i?>')</script></div>">
<img src="<?php echo $g['s']?>/files/avatar/<?php echo $M['photo']?$M['photo']:'0.svg'?>" width="48" height="48" alt="프로필 사진<?php echo $M['nic']?>" class="rounded-circle">
</a>
<?php else:?>
<i class="fa fa-bullhorn fa-2x mr-3 text-muted"></i>
<?php endif?>
<div class="media-body">
<div class="rb-message">
<?php echo $R['message']?>
<?php if($R['referer']):?>
<a href="<?php echo $R['referer']?>" target="<?php echo $R['target']=='_blank'?$R['target']:'_ADMPNL_'?>" onclick="parent.getId('_close_btn_').click();">더보기 &raquo;</a>
<?php endif?>
</div>
<div class="small text-muted">
<?php if($R['frommbr']):?>From <?php echo $M['nic']?> <?php endif?>
<?php echo getDateFormat($R['d_regis'],'n월 j일 A g시 i분')?>
<?php if($callMod=='view'):?>
<div class="btn-toolbar pull-right">
<div class="btn-group-toggle">
<label id="noti-<?php echo $R['uid']?>" class="btn btn-secondary btn-sm" title="선택" data-tooltip="tooltip">
<input type="checkbox" name="noti_members[]" value="<?php echo $R['uid']?>|<?php echo $R['frommbr']?>|<?php echo $R['frommodule']?>" class="hidden" onclick="noti_check_child(this);">
<i class="fa fa-check"></i>
</label>
</div>
</div>
<?php endif?>
</div>
</div>
</div>
</div>
<?php if($NT_DATA[2]&&$R['d_read']) getDbDelete($table['s_notice'],"uid='".$R['uid']."'")?>
<?php $_i++;endwhile?>
<?php if(!$_i):?>
<div class="list-group-item media">
<div class="pull-left">
<i class="glyphicon glyphicon-info-sign fa-3x"></i>
</div>
<div class="media-body">
<?php echo sprintf('<strong>%s</strong>님, 새 알림이 없습니다.<br>알림을 이용하시면 새로운 정보를 실시간으로 받아볼 수 있습니다.',$my[$_HS['nametype']])?><br>
<div class="rb-time">
<?php echo getDateFormat($date['totime'],'n월 j일 A g시 i분')?>
</div>
</div>
</div>
<?php
endif;
$not_readnum = getDbRows($table['s_notice'],'mbruid='.$my['uid']." and d_read=''");
if($my['num_notice'] != $not_readnum) getDbUpdate($table['s_mbrdata'],'num_notice='.$not_readnum,'memberuid='.$my['uid']);
?>
<img src="<?php echo $g['s']?>/_core/images/blank.gif" onload="<?php if($my['admin']):?>top.frames._ADMPNL_.<?php endif?>pushNotification(<?php echo $not_readnum?>);getNotificationNum(<?php echo $_i?>);">
:RESULT]
<?php
exit;
endif;
if ($isModal!='Y'):
$not_readnum = getDbRows($table['s_notice'],'mbruid='.$my['uid']." and d_read=''");
if($my['num_notice'] != $not_readnum) getDbUpdate($table['s_mbrdata'],'num_notice='.$not_readnum,'memberuid='.$my['uid']);
?>
<meta http-equiv="refresh" content="<?php echo $d['ntfc']['sec']?>;url=<?php echo $g['s']?>/?r=<?php echo $r?>&m=notification&a=notice_check">
<script>
parent.pushNotification(<?php echo $not_readnum?>);
</script>
<?php
endif;
exit;
?>

View File

@@ -0,0 +1,90 @@
<?php
if(!defined('__KIMS__')) exit;
if (!$my['uid']) getLink('','','정상적인 접근이 아닙니다.','');
$NT_DATA = explode('|',$my['noticeconf']);
if ($member_uid)
{
$NT_STRING = $NT_DATA[0].'|'.$NT_DATA[1].'|'.$NT_DATA[2].'|'.$NT_DATA[3].'|'.str_replace('['.$member_uid.']','',$NT_DATA[4]).'|'.$NT_DATA[5].'|';
getDbUpdate($table['s_mbrdata'],"noticeconf='".$NT_STRING."'",'memberuid='.$my['uid']);
setrawcookie('member_settings_result', rawurlencode('해제 되었습니다.'));
getLink('reload','parent.','','');
}
else if ($module_id)
{
$NT_STRING = $NT_DATA[0].'|'.$NT_DATA[1].'|'.$NT_DATA[2].'|'.str_replace('['.$module_id.']','',$NT_DATA[3]).'|'.$NT_DATA[4].'|'.$NT_DATA[5].'|';
getDbUpdate($table['s_mbrdata'],"noticeconf='".$NT_STRING."'",'memberuid='.$my['uid']);
if ($mobile) {
echo '<script type="text/javascript">';
echo 'parent.$.notify({message: "알림이 설정되었습니다."},{type: "default"});';
echo '</script>';
exit();
} else {
setrawcookie('member_settings_result', rawurlencode('알림이 설정되었습니다.'));
getLink('reload','parent.','','');
}
}
else {
$NT_STRING = $nt_web.'|'.$nt_email.'|'.$nt_fcm.'|'.$NT_DATA[3].'|'.$NT_DATA[4].'|';
getDbUpdate($table['s_mbrdata'],"noticeconf='".$NT_STRING."'",'memberuid='.$my['uid']);
if (!$mobile) {
if ($sendAjax) {
$result['error']=false;
echo json_encode($result);
exit;
} else {
setrawcookie('member_settings_result', rawurlencode('설정이 저장되었습니다.'));
getLink('reload','parent.','','');
}
} else {
if (!$reload) {
if ($sendAjax) {
$result['error']=false;
echo json_encode($result);
exit;
} else {
if ($nt_email) {
$nt_email_addClass = 'badge-primary badge-pill';
$nt_email_removeClass = 'badge-default badge-outline';
}
else {
$nt_email_addClass = 'badge-default badge-outline';
$nt_email_removeClass = 'badge-primary badge-pill';
}
if ($nt_fcm) {
$nt_fcm_addClass = 'badge-primary badge-pill';
$nt_fcm_removeClass = 'badge-default badge-outline';
}
else {
$nt_fcm_addClass = 'badge-default badge-outline';
$nt_fcm_removeClass = 'badge-primary badge-pill';
}
echo '<script type="text/javascript">';
echo 'parent.$.notify({message: "설정이 저장되었습니다."},{type: "default"});';
echo 'parent.$("#page-main").find("[data-role=email]").addClass("'.$nt_email_addClass.'").removeClass("'.$nt_email_removeClass.'");';
echo 'parent.$("#page-main").find("[data-role=fcm]").addClass("'.$nt_fcm_addClass.'").removeClass("'.$nt_fcm_removeClass.'");';
echo '</script>';
exit();
}
} else {
setrawcookie('member_settings_result', rawurlencode('설정이 저장되었습니다.'));
getLink('reload','parent.','','');
}
}
}
?>

View File

@@ -0,0 +1,23 @@
<?php
if(!defined('__KIMS__')) exit;
checkAdmin(0);
/* 알림을 보내는 방법 ************************************************************
- 다음의 함수를 실행합니다.
putNotice($rcvmember,$sendmodule,$sendmember,$message,$referer,$target);
$rcvmember : 받는회원 UID
$sendmodule : 보내는모듈 ID
$sendmember : 보내는회원 UID (시스템으로 보낼경우 0)
$message : 보내는 메세지 (관리자 및 허가된 사용자는 HTML태그 사용가능 / 일반 회원은 불가)
$referer : 연결해줄 URL이 있을 경우 http:// 포함하여 지정
$target : 연결할 URL의 링크 TARGET (새창으로 연결하려면 _blank)
********************************************************************************/
putNotice($my['uid'],$m,$my['uid'],'실시간 테스트 알림입니다. 관리자는 <code>html</code> 태그를 사용할 수 있습니다. 자세한 전송방법은 매뉴얼을 참고하세요.','','');
getLink('reload','parent.','','');
?>

View File

@@ -0,0 +1,36 @@
<?php
$g['notiVarForSite'] = $g['path_var'].'site/'.$r.'/notification.var.php';
include_once file_exists($g['notiVarForSite']) ? $g['notiVarForSite'] : $g['path_module'].$m.'/var/var.php';
?>
<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>PUSH</title>
<?php getImport('jquery','jquery.min','3.3.1','js')?>
</head>
<body>
<script>
function loadNotification() {
<?php if($my['num_notice']):?>
parent.$('[data-role="noti-status"]').text(<?php echo $my['num_notice']?>)
<?php if ($browtitle): ?>
parent.document.title = '(<?php echo $my['num_notice']?>) <?php echo $browtitle?>'
<?php endif?>
<?php else: ?>
parent.document.title = '<?php echo $browtitle?>'
parent.$('[data-role="noti-status"]').text('')
<?php endif?>
setTimeout("location.reload();",<?php echo $d['ntfc']['sec']?>000);
}
loadNotification();
</script>
</body>
</html>
<?php
exit;
?>

View File

@@ -0,0 +1,25 @@
<?php
if(!defined('__KIMS__')) exit;
if (!$my['uid']) getLink('','','정상적인 접근이 아닙니다.','');
include_once $g['path_core'].'function/fcm.func.php';
$rcvmember = $mbruid;
$TKD = getDbArray($table['s_iidtoken'],'mbruid='.$rcvmember,'token','uid','asc',0,1);
$g['notiIconForSite'] = $g['path_var'].'site/'.$r.'/homescreen.png';
$g['url_notiIcon'] = $g['s'].'/_var/site/'.$r.'/homescreen-192x192.png';
$avatar = file_exists($g['notiIconForSite']) ? $g['url_notiIcon'] : $g['img_core'].'/touch/homescreen-192x192.png';
$tokenArray = array();
$referer ='';
$tag = '';
while ($row = db_fetch_array($TKD)) {
array_push($tokenArray,$row['token']);
}
getSendFCM($tokenArray,$title,$message,$avatar,$referer,$tag);
$result['error']=false;
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,36 @@
<?php
if(!defined('__KIMS__')) exit;
$result=array();
if ($my['uid'] && $token) {
$agent= $_SERVER['HTTP_USER_AGENT'];
$deviceKind=isMobileConnect($agent);
$deviceType=getDeviceKind($agent,$deviceKind);
$d_regis = $date['totime'];
$is_token=getDbRows($table['s_iidtoken'],'mbruid='.$my['uid'].' and device="'.$deviceType.'"'); // 기존 토큰저장 여부
if (!$is_token) {
getDbInsert($table['s_iidtoken'],'mbruid,token,device,browser,version,d_regis',"'".$my['uid']."','".$token."','".$deviceType."','".$browser."','".$version."','".$d_regis."'");
} else {
$_QVAL = "token='$token',browser='$browser',version='$version',d_update='$d_regis'";
getDbUpdate($table['s_iidtoken'],$_QVAL,'mbruid='.$my['uid'].' and device="'.$deviceType.'"'); //토큰 갱신저장
}
$result['is_token'] = $is_token;
$result['mbruid'] = $my['uid'];
$result['agent'] = $agent;
$result['error'] = false;
} else {
$result['is_token'] = '';
$result['mbruid'] = '';
$result['agent'] = '';
$result['error'] = ture;
}
echo json_encode($result);
exit;
?>

View File

@@ -0,0 +1,4 @@
<?php
if(!defined('__KIMS__')) exit;
include $g['path_module'].$module.'/admin/'.$front.'.php';
?>

View File

@@ -0,0 +1,29 @@
<?php
$license_local = $g['path_module'].$module.'/LICENSE';
$license_global = $g['path_root'].'LICENSE';
if (file_exists($license_local)) $license = $license_local;
else $license = $license_global;
?>
<link href="<?php echo $g['s']?>/_core/css/github-markdown.css" rel="stylesheet">
<?php getImport('jquery-markdown','jquery.markdown','0.0.10','js')?>
<?php @include $g['path_module'].$module.'/var/var.moduleinfo.php' ?>
<article class="rb-docs markdown-body px-5 pt-3">
<h1><?php echo sprintf('%s 모듈정보',ucfirst($MD['name']))?></h1>
<div class="pb-5 readme">
<?php readfile($g['path_module'].$module.'/README.md')?>
</div>
<div class="pb-5">
<h2>라이센스</h2>
<textarea class="form-control" rows="10"><?php readfile($license)?></textarea>
</div>
</article>
<script type="text/javascript">
$(".markdown-body .readme").markdown();
</script>

View File

@@ -0,0 +1,3 @@
.custom-control {
min-width: 180px
}

View File

@@ -0,0 +1,70 @@
<?php
$g['notiVarForSite'] = $g['path_var'].'site/'.$r.'/notification.var.php';
include_once file_exists($g['notiVarForSite']) ? $g['notiVarForSite'] : $g['path_module'].$module.'/var/var.php';
?>
<div id="configbox" class="p-4">
<form name="procForm" action="<?php echo $g['s']?>/" method="post" onsubmit="return saveCheck(this);" class="form-horizontal">
<input type="hidden" name="r" value="<?php echo $r ?>">
<input type="hidden" name="m" value="<?php echo $module ?>">
<input type="hidden" name="a" value="config">
<h4>알림 설정</h4>
<div class="form-group row">
<label class="col-lg-2 col-form-label text-lg-right">알림간격</label>
<div class="col-lg-10 col-xl-9">
<select name="sec" class="form-control custom-select">
<?php for($i = 10; $i < 61; $i=$i+5):?>
<option value="<?php echo $i?>"<?php if($d['ntfc']['sec']==$i):?> selected<?php endif?>><?php echo sprintf('%d 초',$i)?></option>
<?php endfor?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label text-lg-right">알림갯수처리</label>
<div class="col-lg-10 col-xl-9">
<select name="num" class="form-control custom-select">
<option value="10"<?php if($d['ntfc']['num']==10):?> selected<?php endif?>><?php echo sprintf('%d 개 이상일 경우',10)?> +10</option>
<option value="50"<?php if($d['ntfc']['num']==50):?> selected<?php endif?>><?php echo sprintf('%d 개 이상일 경우',50)?> +50</option>
<option value="99"<?php if($d['ntfc']['num']==99):?> selected<?php endif?>><?php echo sprintf('%d 개 이상일 경우',99)?> +99</option>
<option value="100"<?php if($d['ntfc']['num']==100):?> selected<?php endif?>><?php echo sprintf('%d 개 이상일 경우',100)?> +100</option>
<option value="999"<?php if($d['ntfc']['num']==999):?> selected<?php endif?>><?php echo sprintf('%d 개 이상일 경우',999)?> +999</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label text-lg-right">알림차단 모듈</label>
<div class="col-lg-10 col-xl-9">
<?php $_MODULES=getDbArray($table['s_module'],'','*','gid','asc',0,1)?>
<?php while($_MD=db_fetch_array($_MODULES)):?>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" class="custom-control-input" id="module_members_<?php echo $_MD['id']?>" name="module_members[]" value="<?php echo $_MD['id']?>"<?php if(strstr($d['ntfc']['cut_modules'],'['.$_MD['id'].']')):?> checked<?php endif?>>
<label class="custom-control-label" for="module_members_<?php echo $_MD['id']?>"><?php echo $_MD['name']?> <small class="text-muted">(<?php echo $_MD['id']?>)</small></label>
</div>
<?php endwhile?>
<p class="form-text text-muted mt-3">
알림을 원천적으로 차단할 모듈을 선택해주세요.
</p>
</div>
</div>
<div class="row">
<div class="col-lg-10 offset-lg-2 col-xl-9 offset-xl-2">
<button type="submit" class="btn btn-outline-primary btn-lg my-4<?php if($g['device']):?> btn-block<?php endif?>">저장하기</button>
</div>
</div>
</form>
</div>
<script>
function saveCheck(f)
{
getIframeForAction(f);
return true;
}
</script>

View File

@@ -0,0 +1,50 @@
#notification .table th,
#notification .table td {
text-align: center;
}
#notification .table th.rb-message,
#notification .table td.rb-message {
text-align: left;
width: 50%;
}
#notification .rb-none {
text-align: center;
color: #999
}
#notification .pagination {
margin: 0
}
#notification .rb-heading {
margin-bottom: 20px
}
#notification .rb-heading > .form-group:last-child {
margin-bottom: 0
}
#notification .rb-heading .rb-advance.btn.collapsed small:before {
content: "▼";
}
#notification .rb-heading .rb-advance.btn small:before {
content: "▲";
}
#notification .rb-footer {
border-top: 1px solid #eee;
margin: 20px 0;
padding: 20px 0
}
@media (max-width: 480px) {
#notification .rb-footer div {
float: none !important
}
}

View File

@@ -0,0 +1,280 @@
<?php
$sort = $sort ? $sort : 'uid';
$orderby= $orderby ? $orderby : 'desc';
$recnum = $recnum && $recnum < 301 ? $recnum : 30;
$sqlque = 'uid';
$account = $SD['uid'];
$sqlque .= ' and site='.$account;
if ($moduleid) $sqlque .= " and frommodule='".$moduleid."'";
if ($isread)
{
if ($isread == 1) $sqlque .= " and d_read<>''";
else $sqlque .= " and d_read=''";
}
if ($where && $keyw)
{
$sqlque .= getSearchSql($where,$keyw,$ikeyword,'or');
}
$RCD = getDbArray($table['s_notice'],$sqlque,'*',$sort,$orderby,$recnum,$p);
$NUM = getDbRows($table['s_notice'],$sqlque);
$TPG = getTotalPage($NUM,$recnum);
?>
<div id="notification" class="px-4 my-3">
<form name="procForm" action="<?php echo $g['s']?>/" method="get" class="form-horizontal">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $m?>">
<input type="hidden" name="module" value="<?php echo $module?>">
<input type="hidden" name="front" value="<?php echo $front?>">
<div class="form-inline">
<select name="moduleid" class="form-control custom-select" onchange="this.form.submit();">
<option value="">모듈(전체)</option>
<?php $MODULES = getDbArray($table['s_module'],'','*','gid','asc',0,$p)?>
<?php while($MD = db_fetch_array($MODULES)):?>
<option value="<?php echo $MD['id']?>"<?php if($MD['id']==$moduleid):?> selected<?php endif?>><?php echo $MD['name']?> (<?php echo $MD['id']?>)</option>
<?php endwhile?>
</select>
<select name="isread" class="form-control custom-select" onchange="this.form.submit();">
<option value="">상태(전체)</option>
<option value="1"<?php if($isread==1):?> selected<?php endif?>>확인</option>
<option value="2"<?php if($isread==2):?> selected<?php endif?>>미확인</option>
</select>
<select name="recnum" onchange="this.form.submit();" class="form-control custom-select">
<?php for($i=30;$i<=300;$i=$i+30):?>
<option value="<?php echo $i?>"<?php if($i==$recnum):?> selected="selected"<?php endif?>><?php echo sprintf('%d 개',$i)?></option>
<?php endfor?>
</select>
<div class="btn-toolbar ml-2">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-light<?php if($sort=='uid'):?> active<?php endif?>" onclick="btnFormSubmit(this);">
<input type="radio" value="uid" name="sort"<?php if($sort=='uid'):?> checked<?php endif?>> 알림일
</label>
<label class="btn btn-light<?php if($sort=='d_read'):?> active<?php endif?>" onclick="btnFormSubmit(this);">
<input type="radio" value="d_read" name="sort"<?php if($sort=='d_read'):?> checked<?php endif?>> 확인일
</label>
</div>
<div class="btn-group btn-group-toggle ml-2" data-toggle="buttons">
<label class="btn btn-light<?php if($orderby=='desc'):?> active<?php endif?>" onclick="btnFormSubmit(this);">
<input type="radio" value="desc" name="orderby"<?php if($orderby=='desc'):?> checked<?php endif?>> <i class="fa fa-sort-amount-desc"></i> 역순
</label>
<label class="btn btn-light<?php if($orderby=='asc'):?> active<?php endif?>" onclick="btnFormSubmit(this);">
<input type="radio" value="asc" name="orderby"<?php if($orderby=='asc'):?> checked<?php endif?>> <i class="fa fa-sort-amount-asc"></i> 정순
</label>
</div>
</div>
</div><!-- /.form-inline -->
<div class="form-inline mt-2">
<select name="where" class="form-control custom-select">
<option value="message"<?php if($where=='message'):?> selected="selected"<?php endif?>>메시지</option>
<option value="referer"<?php if($where=='referer'):?> selected="selected"<?php endif?>>URL</option>
</select>
<input type="text" name="keyw" value="<?php echo stripslashes($keyw)?>" class="form-control ml-2">
<button class="btn btn-light ml-2" type="submit">검색</button>
<a href="<?php echo $g['adm_href']?>" class="btn btn-light ml-1">초기화</a>
<a href="<?php echo $g['s']?>/?r=<?php echo $r?>&amp;m=<?php echo $module?>&amp;a=notice_testonly" onclick="return hrefCheck(this,true,'정말로 테스트 알림을 보내시겠습니까? ');" class="btn btn-light ml-2">테스트 알림</a>
<a href="#." class="btn btn-light rb-notifications-modal ml-1" role="button" data-toggle="modal" data-target="#modal_window">내알림 보기</a>
</div><!-- /.form-inline -->
</form>
</div>
<form name="listForm" action="<?php echo $g['s']?>/" method="post">
<input type="hidden" name="r" value="<?php echo $r?>">
<input type="hidden" name="m" value="<?php echo $module?>">
<input type="hidden" name="a" value="">
<div class="table-responsive">
<table class="table table-striped f13 text-center">
<colgroup>
<col width="50">
<col width="50">
<col width="80">
<col width="80">
<col>
<col width="100">
<col width="100">
<col width="100">
</colgroup>
<thead class="small text-muted">
<tr>
<th>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkAll-noti-user" id="checkAll-noti-user">
<label class="custom-control-label" for="checkAll-noti-user"></label>
</div>
</th>
<th>번호</th>
<th>보낸사람</th>
<th>받는사람</th>
<th class="text-left">내용</th>
<th>연결 URL</th>
<th>알림일시</th>
<th>확인일시</th>
</tr>
</thead>
<?php $_i=0;while($R=db_fetch_array($RCD)):?>
<?php $SM1=$R['mbruid']?getDbData($table['s_mbrdata'],'memberuid='.$R['mbruid'],'name,nic'):array()?>
<?php $SM2=$R['frommbr']?getDbData($table['s_mbrdata'],'memberuid='.$R['frommbr'],'name,nic'):array()?>
<tr>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkAll-noti-user" id="noti_members_<?php echo $R['uid']?>" name="noti_members[]" value="<?php echo $R['uid']?>" onclick="checkboxCheck();">
<label class="custom-control-label" for="noti_members_<?php echo $R['uid']?>"></label>
</div>
</td>
<td><?php echo $NUM-((($p-1)*$recnum)+$_rec++)?></td>
<td>
<?php if($SM2['name']):?>
<a href="#" data-toggle="modal" data-target="#modal_window" class="rb-modal-mbrinfo badge badge-pill badge-dark" onmousedown="mbrIdDrop('<?php echo $R['frommbr']?>','notice');">
<?php echo $SM2[$_HS['nametype']]?></a>
<?php else:?>
<span class="badge badge-pill badge-dark">시스템</span>
<?php endif?>
</td>
<td>
<a href="#" data-toggle="modal" data-target="#modal_window" class="rb-modal-mbrinfo badge badge-pill badge-dark" onmousedown="mbrIdDrop('<?php echo $R['mbruid']?>','notice');">
<?php echo $SM1[$_HS['nametype']]?>
</a>
</td>
<td class="text-left">
<a tabindex="0" class="muted-link" role="button" data-toggle="popover" data-trigger="focus" data-html="true" data-content="<?php echo $R['message'] ?>"><?php echo getStrCut($R['message'],'80','..')?></a>
</td>
<td>
<?php if($R['referer']):?>
<a class="badge badge-pill badge-dark" href="<?php echo $R['referer']?>" target="<?php echo $R['target']?>">보기</a>
<?php else:?>
<span class="small text-muted">없음</span>
<?php endif?>
</td>
<td class="rb-update">
<time class="timeago small text-muted" data-toggle="tooltip" datetime="<?php echo getDateFormat($R['d_regis'],'c')?>" data-tooltip="tooltip" title="<?php echo getDateFormat($R['d_regis'],'Y.m.d H:i')?>"></time>
</td>
<td class="rb-update">
<?php if($R['d_read']):?>
<time class="timeago small text-muted" data-toggle="tooltip" datetime="<?php echo getDateFormat($R['d_read'],'c')?>" data-tooltip="tooltip" title="<?php echo getDateFormat($R['d_read'],'Y.m.d H:i')?>"></time>
<?php else:?>
<span class="badge badge-pill badge-dark">미확인</span>
<?php endif?>
</td>
</tr>
<?php $_i++;endwhile?>
</table>
</div>
<?php if(!$NUM):?>
<div class="rb-none">알림이 없습니다.</div>
<?php endif?>
<div class="d-flex justify-content-between px-3 my-4">
<div>
<button type="button" onclick="chkFlag('noti_members[]');checkboxCheck();" class="btn btn-light">선택/해제</button>
<button type="button" onclick="actCheck('multi_delete');" class="btn btn-light" id="rb-action-btn" disabled>삭제</button>
</div>
<ul class="pagination">
<script>getPageLink(5,<?php echo $p?>,<?php echo $TPG?>,'');</script>
</ul>
</div>
</form>
<?php include $g['path_module'].'member/admin/_modal.php';?>
<!-- timeago -->
<?php getImport('jquery-timeago','jquery.timeago',false,'js')?>
<?php getImport('jquery-timeago','locales/jquery.timeago.'.$lang['notification']['a2039'],false,'js')?>
<script>
putCookieAlert('result_noti_main') // 실행결과 알림 메시지 출력
jQuery(document).ready(function() {
$(".rb-update time").timeago();
});
// 회원 이름,닉네임 클릭시 uid & mod( 탭 정보 : info, main, post 등) 지정하는 함수
var _mbrModalUid;
var _mbrModalMod;
function mbrIdDrop(uid,mod)
{
_mbrModalUid = uid;
_mbrModalMod = mod;
}
// 회원정보 modal 호출하는 함수 : 위에서 지정한 회원 uid & mod 로 호출한다 .
$('.rb-modal-mbrinfo').on('click',function() {
modalSetting('modal_window','<?php echo getModalLink('&amp;m=admin&amp;module=member&amp;front=modal.mbrinfo&amp;uid=')?>'+_mbrModalUid+'&amp;tab='+_mbrModalMod);
});
$('[data-toggle="popover"]').popover()
//사이트 셀렉터 출력
$('[data-role="siteSelector"]').removeClass('d-none')
$(".checkAll-noti-user").click(function(){
$(".rb-noti-user").prop("checked",$(".checkAll-noti-user").prop("checked"));
checkboxCheck();
});
function checkboxCheck()
{
var f = document.listForm;
var l = document.getElementsByName('noti_members[]');
var n = l.length;
var i;
var j=0;
for (i = 0; i < n; i++)
{
if (l[i].checked == true) j++;
}
if (j) getId('rb-action-btn').disabled = false;
else getId('rb-action-btn').disabled = true;
}
function actCheck(act)
{
var f = document.listForm;
var l = document.getElementsByName('noti_members[]');
var n = l.length;
var j = 0;
var i;
var s = '';
for (i = 0; i < n; i++)
{
if(l[i].checked == true)
{
j++;
s += '['+l[i].value+']';
}
}
if (!j)
{
alert('선택된 알림이 없습니다. ');
return false;
}
if (act == 'multi_delete')
{
if(confirm('정말로 삭제하시겠습니까? '))
{
getIframeForAction(f);
f.a.value = act;
f.submit();
}
}
return false;
}
</script>

View File

@@ -0,0 +1,4 @@
<?php
$d['amenu']['config'] = '환경설정';
$d['amenu']['main'] = '알림로그';
?>

View File

@@ -0,0 +1,3 @@
<?php
if(!defined('__KIMS__')) exit;
?>

View File

@@ -0,0 +1 @@
알림

View File

@@ -0,0 +1,11 @@
<?php
/*
각각의 링크를 제공하려면 다음과 같은 형식으로 지정해 주세요.
이 링크는 관리자모드 모듈정보 링크에 사용됩니다.
*/
$d['moduleinfo']['market'] = 'http://www.kimsq.co.kr/market'; // 마켓
$d['moduleinfo']['github'] = 'https://github.com/kimsQ/rb'; // 저장소
$d['moduleinfo']['issue'] = 'https://github.com/kimsQ/rb/issues'; // 이슈접수
$d['moduleinfo']['website'] = 'http://www.kimsq.co.kr/'; // 웹사이트
$d['moduleinfo']['help'] = 'http://docs.kimsq.com/rb2/docs/c/Users/modules/notification'; // 도움말
?>

View File

@@ -0,0 +1,5 @@
<?php
$d['ntfc']['sec'] = "20";
$d['ntfc']['num'] = "10";
$d['ntfc']['cut_modules'] = "[admin][project][market][module][site][layout][mediaset][domain][device][notification][search][tag][popup][dashboard][connect]";
?>