2022-09-17 20:50:50 +09:00
|
|
|
<?php
|
2024-09-19 20:57:39 +09:00
|
|
|
if (!defined('_GNUBOARD_'))
|
2024-09-23 11:07:19 +09:00
|
|
|
exit;
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$yoil = array("일", "월", "화", "수", "목", "금", "토");
|
2022-09-17 20:50:50 +09:00
|
|
|
$is_add_register = $config['cf_1'] ? true : false;
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function get_category_list($bo_table = '', $ca_name = '')
|
2022-09-17 20:50:50 +09:00
|
|
|
{
|
2024-09-19 20:57:39 +09:00
|
|
|
global $g5, $board, $is_admin;
|
|
|
|
|
|
2024-09-23 11:07:19 +09:00
|
|
|
$categories = explode("|", $board['bo_category_list']);
|
2024-09-19 20:57:39 +09:00
|
|
|
$str = "";
|
|
|
|
|
for ($i = 0; $i < count($categories); $i++) {
|
|
|
|
|
$category = trim($categories[$i]);
|
|
|
|
|
if (!$category)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
$btn_class = "etc";
|
|
|
|
|
if ($category == $ca_name) {
|
|
|
|
|
$btn_class = " point";
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
$str .= "<li><a href='?bo_table={$bo_table}&sca={$categories[$i]}' class='ui-btn {$btn_class}'>$categories[$i]</a></li>\n";
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
return $str;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function get_mmb_image($bo_table, $wr_id)
|
|
|
|
|
{
|
2024-09-19 20:57:39 +09:00
|
|
|
global $g5, $config;
|
2024-09-30 01:58:32 +09:00
|
|
|
$sql = "SELECT bf_file, bf_width, bf_height FROM {$g5['board_file_table']}
|
2022-09-17 20:50:50 +09:00
|
|
|
where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_type between '1' and '3' order by bf_no limit 0, 1 ";
|
2024-09-19 20:57:39 +09:00
|
|
|
$row = sql_fetch($sql);
|
|
|
|
|
|
|
|
|
|
if ($row['bf_file']) {
|
|
|
|
|
$src = G5_DATA_URL . '/file/' . $bo_table . "/" . $row['bf_file'];
|
|
|
|
|
$w = $row['bf_width'];
|
|
|
|
|
$h = $row['bf_height'];
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-23 11:07:19 +09:00
|
|
|
$thumb = ["src" => $src, "width" => $w, "height" => $h];
|
2024-09-19 20:57:39 +09:00
|
|
|
return $thumb;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function del_html($str)
|
|
|
|
|
{
|
2024-09-19 20:57:39 +09:00
|
|
|
$str = str_replace(">", ">", $str);
|
|
|
|
|
$str = str_replace("<", "<", $str);
|
|
|
|
|
$str = str_replace("\"", """, $str);
|
|
|
|
|
$str = str_replace("<br>", "<br>", $str); //br은되게함
|
|
|
|
|
return $str;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
2024-09-23 11:07:19 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function help($help = "")
|
2022-09-17 20:50:50 +09:00
|
|
|
{
|
2024-09-19 20:57:39 +09:00
|
|
|
global $g5;
|
|
|
|
|
$str = '<span class="frm_info">' . str_replace("\n", "<br>", $help) . '</span>';
|
|
|
|
|
return $str;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function upload_file($srcfile, $destfile, $dir)
|
|
|
|
|
{
|
2024-09-19 20:57:39 +09:00
|
|
|
if ($destfile == "")
|
|
|
|
|
return false;
|
|
|
|
|
@move_uploaded_file($srcfile, $dir . '/' . $destfile);
|
|
|
|
|
@chmod($dir . '/' . $destfile, G5_FILE_PERMISSION);
|
|
|
|
|
return true;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function check_site_auth()
|
|
|
|
|
{
|
|
|
|
|
global $g5, $config, $is_member;
|
|
|
|
|
$is_page_login = (strstr($_SERVER["REQUEST_URI"], 'login') == "") ? false : true;
|
|
|
|
|
if (!$config['cf_open']) {
|
|
|
|
|
if (!$is_member && !$is_page_login) {
|
|
|
|
|
goto_url(G5_BBS_URL . '/login.php');
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-17 20:50:50 +09:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function goto_url_top($url)
|
|
|
|
|
{
|
2024-09-19 20:57:39 +09:00
|
|
|
$url = str_replace("&", "&", $url);
|
|
|
|
|
if (!headers_sent())
|
|
|
|
|
header('Location: ' . $url);
|
|
|
|
|
else {
|
|
|
|
|
echo '<script>';
|
|
|
|
|
echo 'top.location.replace("' . $url . '");';
|
|
|
|
|
echo '</script>';
|
|
|
|
|
echo '<noscript>';
|
|
|
|
|
echo '<meta http-equiv="refresh" content="0;url=' . $url . '" />';
|
|
|
|
|
echo '</noscript>';
|
|
|
|
|
}
|
|
|
|
|
exit;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function get_logo()
|
|
|
|
|
{
|
|
|
|
|
global $g5;
|
2024-09-30 01:58:32 +09:00
|
|
|
$logo = sql_fetch("SELECT cs_value FROM {$g5['css_table']} where cs_name = 'logo'");
|
2024-09-19 20:57:39 +09:00
|
|
|
return $logo['cs_value'];
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function get_style($code, $field = '*')
|
|
|
|
|
{
|
|
|
|
|
global $g5;
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
if (!$field)
|
|
|
|
|
$field = " * ";
|
2024-09-30 01:58:32 +09:00
|
|
|
$result = sql_fetch("SELECT " . $field . " FROM {$g5['css_table']} where cs_name = '" . $code . "'");
|
2024-09-19 20:57:39 +09:00
|
|
|
return $result;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function get_site_content($co_id)
|
|
|
|
|
{
|
|
|
|
|
global $g5, $config, $is_member;
|
|
|
|
|
|
|
|
|
|
$result = "";
|
2024-09-30 01:58:32 +09:00
|
|
|
$co = sql_fetch("SELECT * FROM {$g5['content_table']} where co_id = '{$co_id}' ");
|
2024-09-19 20:57:39 +09:00
|
|
|
|
|
|
|
|
$pc_str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']);
|
|
|
|
|
$mo_str = conv_content($co['co_mobile_content'], $co['co_html'], $co['co_tag_filter_use']);
|
|
|
|
|
|
|
|
|
|
// 내용 변환 진행
|
|
|
|
|
$no_mem = "";
|
|
|
|
|
$use_mem = "";
|
|
|
|
|
|
|
|
|
|
if ($is_member) {
|
|
|
|
|
$no_mem = " style='display: none;' ";
|
|
|
|
|
}
|
|
|
|
|
if (!$is_member) {
|
|
|
|
|
$use_mem = " style='display: none;' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{LOGIN}}") || strstr($mo_str, "{{LOGIN}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.login.php';
|
|
|
|
|
$login_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{LOGIN}}", $login_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{LOGIN}}", $login_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{LOGOUT}}") || strstr($mo_str, "{{LOGOUT}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.logout.php';
|
|
|
|
|
$logout_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{LOGOUT}}", $logout_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{LOGOUT}}", $logout_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{JOIN}}") || strstr($mo_str, "{{JOIN}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.join.php';
|
|
|
|
|
$join_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{JOIN}}", $join_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{JOIN}}", $join_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{MYPAGE}}") || strstr($mo_str, "{{MYPAGE}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.mypage.php';
|
|
|
|
|
$mypage_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{MYPAGE}}", $mypage_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{MYPAGE}}", $mypage_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{BGM}}") || strstr($mo_str, "{{BGM}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.bgm.php';
|
|
|
|
|
$visual_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{BGM}}", $visual_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{BGM}}", $visual_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{VISUAL_SLIDE}}") || strstr($mo_str, "{{VISUAL_SLIDE}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.visual.php';
|
|
|
|
|
$visual_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{VISUAL_SLIDE}}", $visual_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{VISUAL_SLIDE}}", $visual_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{TWITTER}}") || strstr($mo_str, "{{TWITTER}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.twitter.php';
|
|
|
|
|
$visual_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{TWITTER}}", $visual_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{TWITTER}}", $visual_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strstr($pc_str, "{{OUTLOGIN}}") || strstr($mo_str, "{{OUTLOGIN}}")) {
|
|
|
|
|
ob_start();
|
|
|
|
|
include G5_PATH . '/templete/txt.outlogin.php';
|
|
|
|
|
$visual_str = ob_get_contents();
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
|
|
$pc_str = str_replace("{{OUTLOGIN}}", $visual_str, $pc_str);
|
|
|
|
|
$mo_str = str_replace("{{OUTLOGIN}}", $visual_str, $mo_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($co['co_content']) {
|
|
|
|
|
if ($co['co_mobile_content']) {
|
|
|
|
|
$result .= "<div class='only-pc'>" . $pc_str . "</div>";
|
|
|
|
|
} else {
|
|
|
|
|
$result .= $pc_str;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($co['co_mobile_content']) {
|
|
|
|
|
$result .= "<div class='not-pc'>" . $mo_str . "</div>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $result;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function emote_ev($comment)
|
|
|
|
|
{
|
|
|
|
|
global $g5;
|
|
|
|
|
|
2024-09-30 01:58:32 +09:00
|
|
|
$emo_result = sql_query("SELECT * FROM {$g5['emoticon_table']}");
|
2024-09-19 20:57:39 +09:00
|
|
|
$str = $comment;
|
2022-09-17 20:50:50 +09:00
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
for ($i = 0; $row = sql_fetch_array($emo_result); $i++) {
|
|
|
|
|
$str = str_replace($row['me_text'], "<img src=\"" . G5_URL . $row["me_img"] . "\">", $str);
|
|
|
|
|
}
|
|
|
|
|
return $str;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function have_jongsung($chr)
|
|
|
|
|
{
|
|
|
|
|
static $no_jongsung = "가갸거겨고교구규그기개걔게계과괘궈궤괴귀긔까꺄꺼껴꼬꾜꾸뀨끄끼깨꺠께꼐꽈꽤꿔꿰꾀뀌끠나냐너녀노뇨누뉴느니내냬네녜놔놰눠눼뇌뉘늬다댜더뎌도됴두듀드디대댸데뎨돠돼둬뒈되뒤듸따땨떠뗘또뚀뚜뜌뜨띠때떄떼뗴똬뙈뚸뛔뙤뛰띄라랴러려로료루류르리래럐레례롸뢔뤄뤠뢰뤼릐마먀머며모묘무뮤므미매먜메몌뫄뫠뭐뭬뫼뮈믜바뱌버벼보뵤부뷰브비배뱨베볘봐봬붜붸뵈뷔븨빠뺘뻐뼈뽀뾰뿌쀼쁘삐빼뺴뻬뼤뽜뽸뿨쀄뾔쀠쁴사샤서셔소쇼수슈스시새섀세셰솨쇄숴쉐쇠쉬싀싸쌰써쎠쏘쑈쑤쓔쓰씨쌔썌쎄쎼쏴쐐쒀쒜쐬쒸씌아야어여오요우유으이애얘에예와왜워웨외위의자쟈저져조죠주쥬즈지재쟤제졔좌좨줘줴죄쥐즤짜쨔쩌쪄쪼쬬쭈쮸쯔찌째쨰쩨쪠쫘쫴쭤쮀쬐쮜쯰차챠처쳐초쵸추츄츠치채챼체쳬촤쵀춰췌최취츼카캬커켜코쿄쿠큐크키캐컈케켸콰쾌쿼퀘쾨퀴킈타탸터텨토툐투튜트티태턔테톄톼퇘퉈퉤퇴튀틔파퍄퍼펴포표푸퓨프피패퍠페폐퐈퐤풔풰푀퓌픠하햐허혀호효후휴흐히해햬헤혜화홰훠훼회휘희2459";
|
|
|
|
|
return strpos($no_jongsung, $chr) === false ? true : false;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function j($s, $have_jongsung)
|
|
|
|
|
{
|
|
|
|
|
switch ($have_jongsung) {
|
|
|
|
|
case "은":
|
|
|
|
|
$no_jongsung = "는";
|
|
|
|
|
break;
|
|
|
|
|
case "이":
|
|
|
|
|
$no_jongsung = "가";
|
|
|
|
|
break;
|
|
|
|
|
case "을":
|
|
|
|
|
$no_jongsung = "를";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$last_chr = mb_substr($s, -1, 1, 'UTF-8');
|
|
|
|
|
return have_jongsung($last_chr) ?
|
|
|
|
|
$have_jongsung :
|
|
|
|
|
$no_jongsung;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 20:57:39 +09:00
|
|
|
function hex2rgba($color, $opacity = false)
|
|
|
|
|
{
|
|
|
|
|
$default = 'rgb(0,0,0)';
|
|
|
|
|
if (empty($color))
|
|
|
|
|
return $default;
|
|
|
|
|
if ($color[0] == '#') {
|
|
|
|
|
$color = substr($color, 1);
|
|
|
|
|
}
|
|
|
|
|
if (strlen($color) == 6) {
|
|
|
|
|
$hex = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]);
|
|
|
|
|
} elseif (strlen($color) == 3) {
|
|
|
|
|
$hex = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]);
|
|
|
|
|
} else {
|
|
|
|
|
return $default;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$rgb = array_map('hexdec', $hex);
|
|
|
|
|
|
|
|
|
|
if ($opacity) {
|
|
|
|
|
$opacity = (100 - $opacity) / 100;
|
|
|
|
|
if (abs($opacity) > 1)
|
|
|
|
|
$opacity = 1.0;
|
|
|
|
|
$output = 'rgba(' . implode(",", $rgb) . ',' . $opacity . ')';
|
|
|
|
|
} else {
|
|
|
|
|
$output = 'rgb(' . implode(",", $rgb) . ')';
|
|
|
|
|
}
|
|
|
|
|
return $output;
|
2022-09-17 20:50:50 +09:00
|
|
|
}
|