first
This commit is contained in:
25
modules/notification/action/a.config.php
Normal file
25
modules/notification/action/a.config.php
Normal 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.','반영 되었습니다.','');
|
||||
?>
|
||||
56
modules/notification/action/a.get_moreList.php
Normal file
56
modules/notification/action/a.get_moreList.php
Normal 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;
|
||||
?>
|
||||
25
modules/notification/action/a.get_notiData.php
Normal file
25
modules/notification/action/a.get_notiData.php
Normal 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;
|
||||
?>
|
||||
72
modules/notification/action/a.get_notiList.php
Normal file
72
modules/notification/action/a.get_notiList.php
Normal 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;
|
||||
?>
|
||||
36
modules/notification/action/a.get_notiNum.php
Normal file
36
modules/notification/action/a.get_notiNum.php
Normal 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;
|
||||
?>
|
||||
13
modules/notification/action/a.get_notiNum_ajax.php
Normal file
13
modules/notification/action/a.get_notiNum_ajax.php
Normal 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;
|
||||
?>
|
||||
27
modules/notification/action/a.multi_delete.php
Normal file
27
modules/notification/action/a.multi_delete.php
Normal 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.','','');
|
||||
?>
|
||||
90
modules/notification/action/a.multi_delete_user.php
Normal file
90
modules/notification/action/a.multi_delete_user.php
Normal 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.','','');
|
||||
?>
|
||||
92
modules/notification/action/a.notice_check.php
Normal file
92
modules/notification/action/a.notice_check.php
Normal 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">×</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();">더보기 »</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;
|
||||
?>
|
||||
90
modules/notification/action/a.notice_config_user.php
Normal file
90
modules/notification/action/a.notice_config_user.php
Normal 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.','','');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
23
modules/notification/action/a.notice_testonly.php
Normal file
23
modules/notification/action/a.notice_testonly.php
Normal 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.','','');
|
||||
?>
|
||||
36
modules/notification/action/a.push.php
Normal file
36
modules/notification/action/a.push.php
Normal 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;
|
||||
?>
|
||||
25
modules/notification/action/a.push_testonly.php
Normal file
25
modules/notification/action/a.push_testonly.php
Normal 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;
|
||||
?>
|
||||
36
modules/notification/action/a.save_token.php
Normal file
36
modules/notification/action/a.save_token.php
Normal 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;
|
||||
?>
|
||||
Reference in New Issue
Block a user