리빌더 부분 추가

This commit is contained in:
2025-07-02 14:13:16 +09:00
parent b491c16b5e
commit 68797db562
1200 changed files with 264947 additions and 0 deletions

View File

@ -0,0 +1,91 @@
var show_alarm_exist=false;
function check_alarm(){
$.ajax({
type: 'POST',
data: { act: 'alarm' },
url: memo_alarm_url + '/get-events.php',
dataType: 'json',
async: true,
cache: false,
success: function(result) {
if(result.msg == 'SUCCESS') {
// URL을 추출하는 정규식
const urlRegex = /(https?:\/\/[^\s]+)/g;
const urlMatches = result.content.match(urlRegex);
// 추출된 URL이 있으면 그 값을 사용하고, 없으면 me_id 사용
const urlOrMeId = urlMatches ? urlMatches[0] : result.me_id;
// 추출된 값을 show_alarm으로 전달
show_alarm(result.title, result.content, result.url, urlOrMeId, result.me_send_datetime, result.me_id);
} else {
// 오류 처리
}
}
});
}
function show_alarm(title, content, url, urlOrMeId, me_send_datetime, me_id) {
if(show_alarm_exist) hide_alarm();
show_alarm_exist = true;
var html = "";
// audio.play(); // 알림 소리 재생
html = "<div id='alarm_layer' class='wrapper-notification bottom right side' style='display:none'>";
html += "<div class='notification notification-primary notification-msg animated bounceInUp' id='" + me_id + "'>";
// 알림 옵션 부분 (닫기 버튼, 읽음 처리 버튼 등)
html += "<div class='notification-option'>";
html += "<button class='notification-check' data-toggle='tooltip' data-trigger='hover' data-html='true' data-placement='top' data-original-title='읽음' onclick='set_recv_memo(\"" + me_id + "\")'>";
html += "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-x'><line x1='18' y1='6' x2='6' y2='18'></line><line x1='6' y1='6' x2='18' y2='18'></line></svg></button>";
html += "</div>";
html += "<a href='../bbs/memo_view.php?me_id=" + me_id + "&kind=recv' onclick='win_memo(this.href); return false;'>";
html += "<div class='notification-heading'><span class='font-B'>새 알림</span> <span class='al_date'>" + me_send_datetime + "</span></div>";
html += "<div class='notification-content cut2 cursor'>" + content + "</div>";
html += "</a>";
html += "</div>";
html += "</div>";
$('body').prepend(html);
$('#alarm_layer').fadeIn();
setTimeout(function(){ hide_alarm(); }, 30000);
}
function hide_alarm(){
if(show_alarm_exist){
show_alarm_exist=false;
$("#alarm_layer").fadeOut(400,function(){
$('#alarm_layer').remove();
});
}
}
function set_recv_memo(me_id){
$.ajax({
type:'POST',
data : ({act : 'recv_memo', me_id : me_id}),
url: memo_alarm_url + '/get-events.php',
dataType:'json',
async:true,
cache:false,
success:function(result){
if(result.msg=='SUCCESS'){
hide_alarm();
}else{
}
}
});
}
function RemoveTag(s){
var tmp = '';
tmp = s;
tmp = tmp.replace('<','&lt;');
tmp = tmp.replace('>','&gt;');
tmp = tmp.replace('"','&quot;');
return tmp;
}

355
rb/rb.mod/alarm/alarm.css Normal file
View File

@ -0,0 +1,355 @@
.alert {
padding: 10px;
margin-bottom: 10px;
border: 1px solid transparent;
border-radius: 3px;
}
.alert h4 {
margin-top: 0;
color: inherit
}
.alert .alert-link {
font-weight: bold
}
.alert>p,
.alert>ul {
margin-bottom: 0
}
.alert>p+p {
margin-top: 5px
}
.alert-dismissable,
.alert-dismissible {
padding-right: 35px
}
.alert-dismissable .close,
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
color: inherit
}
.alert-success {
background-color: #dff0d8;
border-color: #d6e9c6;
color: #3c763d
}
.alert-success hr {
border-top-color: #c9e2b3
}
.alert-success .alert-link {
color: #2b542c
}
.alert-info {
background-color: #d9edf7;
border-color: #bce8f1;
color: #31708f
}
.alert-info hr {
border-top-color: #a6e1ec
}
.alert-info .alert-link {
color: #245269
}
.alert-warning {
background-color: #fcf8e3;
border-color: #faebcc;
color: #8a6d3b
}
.alert-warning hr {
border-top-color: #f7e1b5
}
.alert-warning .alert-link {
color: #66512c
}
.alert-danger {
background-color: #f2dede;
border-color: #ebccd1;
color: #a94442
}
.alert-danger hr {
border-top-color: #e4b9c0
}
.alert-danger .alert-link {
color: #843534
}
.wrapper-alert,
.wrapper-notification {
position: fixed;
padding: 10px;
left: 5px;
bottom:5px;
/*position: absolute;*/
z-index: 999;
/*left: 5px;
right: 5px*/
}
.wrapper-alert.top,
.wrapper-notification.top {
top: 10px
}
.wrapper-alert.bottom,
.wrapper-notification.bottom {
bottom: 0
}
.wrapper-alert.left,
.wrapper-notification.left {
left: 10px;
right: auto
}
.wrapper-alert.right,
.wrapper-notification.right {
left: 50px;
right: auto;
bottom:40px;
}
.wrapper-alert-circle {
position: fixed;
left: 50%;
top: 50%;
margin-top: -60px;
margin-left: -60px;
z-index: 3001
}
.alert-circle {
width: 120px;
height: 120px;
font-size: 150%;
color: #fff;
animation-duration: .2s;
border-radius: 50%;
text-align: center;
padding-top: 65px
}
.notification,
.notification-custom {
padding: 20px;
margin-bottom: 0px;
border: 0px;
border-radius: 5px;
box-shadow: 5px 5px 15px rgba(0, 0, 0, .1);
background: #fff;
min-width: 300px;
max-height: 600px;
overflow-y: auto;
position: relative;
word-wrap: break-word;
font-size: 13px;
}
.notification-close,
.notification-custom-close {
text-align: right
}
.notification-close>.dropdown-menu,
.notification-custom-close>.dropdown-menu {
top: 8px;
float: right;
right: 20px;
left: auto;
min-width: 50px
}
.notification-close>.dropdown-menu>li,
.notification-custom-close>.dropdown-menu>li {
text-align: right
}
.notification-close>a,
.notification-custom-close>a {
color: #999
}
.notification-close>.close,
.notification-custom-close>.close {
opacity: .6;
font-size: 13px
}
.wrapper-notification.side {
width: 350px
}
.wrapper-notification.side>.notification,
.wrapper-notification.side>.notification-custom {
cursor: pointer;
overflow: visible
}
.wrapper-notification.main {
top: 20%;
left: 50%;
width: 500px;
margin: 0 0 0 -250px
}
.wrapper-notification.main .notification,
.wrapper-notification.main .notification-custom {
padding-left: 10px
}
.notification-heading,
.notification-custom-heading {
padding: 0 15px 10px 0px;
/*color: #005b9e;*/
color: #000;
text-align: left
}
.wrapper-notification.main .notification-heading,
.wrapper-notification.main .notification-custom-heading {
font-size: 116.6666%;
font-weight: bold;
padding-left: 0
}
.notification-success,
.notification-success .notification,
.notification-success .notification-custom {
border-color: #10b045 !important
}
.notification-success .notification-heading,
.notification-success .notification-custom-heading {
color: #10b045 !important
}
.notification-info,
.notification-info .notification,
.notification-info .notification-custom {
border-color: #3a87ad !important
}
.notification-info .notification-heading,
.notification-info .notification-custom-heading {
color: #3a87ad !important
}
.notification-warning,
.notification-warning .notification,
.notification-warning .notification-custom {
border-color: #ff8f32 !important
}
.notification-warning .notification-heading,
.notification-warning .notification-custom-heading {
color: #db741d !important
}
.notification-danger,
.notification-danger .notification,
.notification-danger .notification-custom {
border-color: #d23737 !important
}
.notification-danger .notification-heading,
.notification-danger .notification-custom-heading {
color: #d23737 !important
}
.notification-icon {
position: absolute;
left: 10px;
top: 10px;
z-index: 6;
width: 25px;
height: 25px;
border-radius: 50%;
color: #fff;
background-color: #756FAD;
padding-left: 7px;
padding-top: 3px;
}
.notification-info .notification-icon {
background-color: #3a87ad
}
.notification-success .notification-icon {
background-color: #10b045
}
.notification-warning .notification-icon {
background-color: #ff8f32
}
.notification-danger .notification-icon {
background-color: #d23737
}
.notification-option {
position: absolute;
right: 13px;
top: 15px;
}
.notification-content {line-height: 150%;}
.notification-option .notification-check {
border: none;
color: #000;
background-color: transparent;
}
.al_date {font-size: 11px; color:#888;}
.close {
float: right;
font-size: 18px;
font-weight: bold;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
opacity: .2
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
opacity: .5
}
button.close {
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none
}
@media all and (max-width:1024px) {
.wrapper-alert.right,
.wrapper-notification.right {
max-width:250px;
left: 10px;
bottom:10px;
}
}

94
rb/rb.mod/alarm/alarm.js Normal file
View File

@ -0,0 +1,94 @@
var show_alarm_exist=false;
function check_alarm(){
$.ajax({
type: 'POST',
data: { act: 'alarm' },
url: memo_alarm_url + '/get-events.php',
dataType: 'json',
async: true,
cache: false,
success: function(result) {
if(result.msg == 'SUCCESS') {
// URL을 추출하는 정규식
const urlRegex = /(https?:\/\/[^\s]+)/g;
const urlMatches = result.content.match(urlRegex);
// 추출된 URL이 있으면 그 값을 사용하고, 없으면 me_id 사용
const urlOrMeId = urlMatches ? urlMatches[0] : result.me_id;
// 추출된 값을 show_alarm으로 전달
show_alarm(result.title, result.content, result.url, urlOrMeId, result.me_send_datetime, result.me_id);
} else {
// 오류 처리
}
}
});
}
function show_alarm(title, content, url, urlOrMeId, me_send_datetime, me_id) {
if(show_alarm_exist) hide_alarm();
show_alarm_exist = true;
var html = "";
// audio.play(); // 알림 소리 재생
html = "<div id='alarm_layer' class='wrapper-notification bottom right side' style='display:none'>";
html += "<div class='notification notification-primary notification-msg animated bounceInUp' id='" + me_id + "'>";
// 알림 옵션 부분 (닫기 버튼, 읽음 처리 버튼 등)
html += "<div class='notification-option'>";
html += "<button class='notification-check' data-toggle='tooltip' data-trigger='hover' data-html='true' data-placement='top' data-original-title='읽음' onclick='set_recv_memo(\"" + me_id + "\")'>";
html += "<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-x'><line x1='18' y1='6' x2='6' y2='18'></line><line x1='6' y1='6' x2='18' y2='18'></line></svg></button>";
html += "</div>";
if (urlOrMeId.startsWith("http")) {
html += "<a href='" + urlOrMeId + "' data-original-title='읽음' onclick='set_recv_memo(\"" + me_id + "\");'>";
} else {
html += "<a href='../bbs/memo_view.php?me_id=" + me_id + "&kind=recv' onclick='win_memo(this.href); return false;'>";
}
html += "<div class='notification-heading'><span class='font-B'>새 알림</span> <span class='al_date'>" + me_send_datetime + "</span></div>";
html += "<div class='notification-content cut2 cursor'>" + content + "</div>";
html += "</a>";
html += "</div>";
html += "</div>";
$('body').prepend(html);
$('#alarm_layer').fadeIn();
setTimeout(function(){ hide_alarm(); }, 30000);
}
function hide_alarm(){
if(show_alarm_exist){
show_alarm_exist=false;
$("#alarm_layer").fadeOut(400,function(){
$('#alarm_layer').remove();
});
}
}
function set_recv_memo(me_id){
$.ajax({
type:'POST',
data : ({act : 'recv_memo', me_id : me_id}),
url: memo_alarm_url + '/get-events.php',
dataType:'json',
async:true,
cache:false,
success:function(result){
if(result.msg=='SUCCESS'){
hide_alarm();
}else{
}
}
});
}
function RemoveTag(s){
var tmp = '';
tmp = s;
tmp = tmp.replace('<','&lt;');
tmp = tmp.replace('>','&gt;');
tmp = tmp.replace('"','&quot;');
return tmp;
}

48
rb/rb.mod/alarm/alarm.php Normal file
View File

@ -0,0 +1,48 @@
<?php
if (!defined('_GNUBOARD_')) exit; //개별 페이지 접근 불가
// 간격
//echo help('기본 60000ms, 밀리초(ms)는 천분의 1초. ex) 60초 = 60000ms');
$wset['delay'] = '60000';
$wset['delay'] = (isset($wset['delay']) && $wset['delay'] >= 60000) ? $wset['delay'] : 60000;
$alarm_url = G5_URL . "/rb/rb.mod/alarm";
?>
<?php
// 특정 페이지에서 alarm 표시 안함
$except_alarm_page = array(
'memo.php',
'point.php',
'scrap.php',
'profile.php',
'coupon.php',
'memo_form.php'
);
if (!in_array(basename($_SERVER['PHP_SELF']), $except_alarm_page)) {
if (isset($member['mb_id']) && $member['mb_id']) { // $member 배열과 'mb_id' 키가 정의되어 있는지 확인 ?>
<link rel="stylesheet" href="<?php echo $alarm_url ?>/alarm.css">
<script>
var memo_alarm_url = "<?php echo $alarm_url; ?>";
//var audio = new Audio("<?php echo $alarm_url;?>/memo_on.mp3"); // 임의 폴더 아래에 사운드 파일을 넣고 자바스크립트 동일경로
</script>
<?php
$dirs = dirname($_SERVER['PHP_SELF']); // $PHP_SELF 대신 $_SERVER['PHP_SELF'] 사용
$dirs_chk = str_replace('/', '', $dirs);
?>
<?php if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == $app['ap_title']) { ?>
<script src="<?php echo $alarm_url ?>/alarm.app.js"></script>
<?php } else { ?>
<script src="<?php echo $alarm_url ?>/alarm.js"></script>
<?php } ?>
<script type="text/javascript">
$(function() {
setInterval(function() {
check_alarm();
}, <?php echo $wset['delay'] ?>);
check_alarm();
});
</script>
<?php } ?>
<?php } ?>

11
rb/rb.mod/alarm/animate.min.css vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,43 @@
<?php
include_once('../_common.php');
$act = isset($_POST['act']) ? $_POST['act'] : '';
if ($act == 'alarm') {
$result = array();
$row = sql_fetch("SELECT * FROM {$g5['memo_table']} WHERE me_recv_mb_id = '{$member['mb_id']}' AND me_send_datetime >= NOW() - INTERVAL 2 DAY AND me_read_datetime = '0000-00-00 00:00:00' ORDER BY me_id DESC LIMIT 1");
if ($row) {
$result['content'] = isset($row['me_memo']) ? $row['me_memo'] : '';
$result['msg'] = 'SUCCESS';
$result['me_id'] = isset($row['me_id']) ? $row['me_id'] : '';
//$result['sound'] = 'N';
$mb = get_member($row['me_send_mb_id'], 'mb_name');
$result['title'] = isset($mb['mb_name']) ? $mb['mb_name'] : '';
$result['me_send_datetime'] = isset($row['me_send_datetime']) ? $row['me_send_datetime'] : '';
$result['url'] = G5_URL . '/bbs/memo.php';
} else {
$result['msg'] = 'NOMSG';
$result['me_id'] = '';
}
echo json_encode($result);
}
if ($act == 'recv_memo') {
$result = array();
$me_id = isset($_POST['me_id']) ? $_POST['me_id'] : '';
$sql = "UPDATE {$g5['memo_table']}
SET me_read_datetime = '".G5_TIME_YMDHIS."'
WHERE me_id = '$me_id'
AND me_read_datetime = '0000-00-00 00:00:00'";
sql_query($sql);
$sql = "UPDATE `{$g5['member_table']}` SET mb_memo_cnt = '".get_memo_not_read($member['mb_id'])."' WHERE mb_id = '{$member['mb_id']}'";
sql_query($sql);
$result['msg'] = 'SUCCESS';
echo json_encode($result);
}