', -2);
$sh = ''.PHP_EOL;
$sh .= '';
add_javascript($sh, 0);
}
function prism_tail_sub(){
global $wr_id;
if($_SERVER['SCRIPT_NAME'] != '/bbs/board.php' || !$wr_id) return;
prism_script();
}
function PrismJS($m) {
$str = isset($m[3]) ? $m[3] : '';
if(!$str)
return;
$str = stripslashes($str);
$str = preg_replace("/(
|
|
|
|<\/div>|<\/p>)/i", "", $str);
$str = str_replace(" ", " ", $str);
$str = str_replace("/", "<", $str);
$str = str_replace("/[/", "[", $str);
$str = str_replace("/{/", "{", $str);
if(!$str)
return;
//$brush = isset($m[2]) ? strtolower(trim($m[2])) : 'html';
$brush = 'php';
//prism_script();
return '
'.PHP_EOL;
}
function prism_html_purifier_result($str){
$content = preg_replace_callback("/(\[code\]|\[code=(.*)\])(.*)\[\/code\]/iUs", "PrismJS", $str); // PrismJS
return $content;
}
// 문자 발송 함수 @SIR 플래토님 코드사용 출처 : https://sir.kr/g5_tip/8262
function smsSend($sHp, $rHp, $msg) {
global $g5, $config;
$rtn = "";
try {
$send_hp = str_replace("-","",$sHp); // - 제거
$recv_hp = str_replace("-","",$rHp); // - 제거
$SMS = new SMS; // SMS 객체 생성
$SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']);
$SMS->Add($recv_hp, $send_hp, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($msg)), "");
$SMS->Send();
$rtn = true;
}
catch(Exception $e) {
alert("처리중 문제가 발생했습니다.".$e->getMessage());
$rtn = false;
}
return $rtn;
}
// 새글에 NEW 아이콘
function get_new_ico($bo_table, $ca_name) {
global $g5;
$new_icon = '';
$bbs = sql_fetch("select * from {$g5['board_table']} where bo_table = '{$bo_table}'");
if($bbs && isset($bbs['bo_table'])) {
$write_table = $g5['write_prefix'].$bbs['bo_table'];
if(isset($ca_name) && !empty($ca_name)) {
$time = sql_fetch("select * from {$write_table} where wr_is_comment = 0 and ca_name = '{$ca_name}' order by wr_id desc limit 1");
} else {
$time = sql_fetch("select * from {$write_table} where wr_is_comment = 0 order by wr_id desc limit 1");
}
}
if (isset($bbs['bo_new']) && isset($time['wr_datetime']) && $time['wr_datetime'] >= date("Y-m-d H:i:s", G5_SERVER_TIME - ($bbs['bo_new'] * 3600))) {
$new_icon = '
n';
}
return $new_icon;
}
// 전체 URL (SEO)
function getCurrentUrl() {
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'];
$requestUri = $_SERVER['REQUEST_URI'];
return $protocol . $host . $requestUri;
}
// 안읽은 쪽지
if ($is_member) {
if( isset($member['mb_memo_cnt']) ){
$memo_not_read = $member['mb_memo_cnt'];
} else {
$memo_not_read = get_memo_not_read($member['mb_id']);
}
}
// 날자계산
function passing_time($datetime) {
$time_lag = time() - strtotime($datetime);
if($time_lag < 60) {
$posting_time = "방금";
} else if($time_lag >= 60 and $time_lag < 3600) {
$posting_time = floor($time_lag/60)."분 전";
} else if($time_lag >= 3600 and $time_lag < 86400) {
$posting_time = floor($time_lag/3600)."시간 전";
} else if($time_lag >= 86400 and $time_lag < 2419200) {
$posting_time = floor($time_lag/86400)."일 전";
} else {
$posting_time = date("Y.m.d", strtotime($datetime));
}
return $posting_time;
}
// 날자계산2
function passing_time2($datetime) {
$time_lag = time() - strtotime($datetime);
if($time_lag < 60) {
$posting_time = "방금
".date("Y.m.d", strtotime($datetime));
} else if($time_lag >= 60 and $time_lag < 3600) {
$posting_time = floor($time_lag/60)."분 전
".date("Y.m.d", strtotime($datetime));
} else if($time_lag >= 3600 and $time_lag < 86400) {
$posting_time = floor($time_lag/3600)."시간 전
".date("Y.m.d", strtotime($datetime));
} else if($time_lag >= 86400 and $time_lag < 2419200) {
$posting_time = floor($time_lag/86400)."일 전
".date("Y.m.d", strtotime($datetime));
} else {
$posting_time = "오래 전
".date("Y.m.d", strtotime($datetime));
}
return $posting_time;
}
// 날자계산3
function passing_time3($datetime) {
$time_lag = time() - strtotime($datetime);
if($time_lag < 60) {
$posting_time = "방금";
} else if($time_lag >= 60 and $time_lag < 3600) {
$posting_time = floor($time_lag/60)."분 전";
} else if($time_lag >= 3600 and $time_lag < 86400) {
$posting_time = floor($time_lag/3600)."시간 전";
} else if($time_lag >= 86400 and $time_lag < 2419200) {
$posting_time = floor($time_lag/86400)."일 전";
} else {
$posting_time = "오래 전";
}
return $posting_time;
}
// 회원 게시물 갯수
function wr_cnt($mb_id, $type){
global $g5;
$wr_sum = 0;
$sql = sql_query(" select bo_table from {$g5['board_table']} ");
while($row = sql_fetch_array($sql)) {
$write_table = $g5['write_prefix'] . $row['bo_table'];
if($type == "w") {
$sql2 = " select count(*) as cnt from {$write_table} where mb_id = '{$mb_id}' and wr_is_comment = 0 ";
} else if ($type == "c") {
$sql2 = " select count(*) as cnt from {$write_table} where mb_id = '{$mb_id}' and wr_is_comment = 1 ";
}
$wr = sql_fetch($sql2);
$wr_sum += $wr['cnt'];
}
return $wr_sum;
}
// 생성된 게시판 목록조회
function rb_board_list($bo_tables) {
global $g5;
$str = ""; // 초기화
$sql = " select bo_table, bo_subject from {$g5['board_table']} group by bo_table order by bo_table asc";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
if($bo_tables == $row['bo_table']) {
$str .= "