$categories[$i]\n";
}
return $str;
}
// MMB LIST 이미지 가져오기
function get_mmb_image($bo_table, $wr_id)
{
global $g5, $config;
$filename = $alt = "";
$sql = " select bf_file, bf_width, bf_height from {$g5['board_file_table']}
where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_type between '1' and '3' order by bf_no limit 0, 1 ";
$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;
}
$thumb = array("src"=>$src, "width"=>$w, "height"=>$h);
return $thumb;
}
function del_html($str)
{
$str = str_replace( ">", ">",$str );
$str = str_replace( "<", "<",$str );
$str = str_replace( "\"", """,$str );
$str = str_replace( "<br>","
",$str); //br은되게함
return $str;
}
// 입력 폼 안내문
function help($help="")
{
global $g5;
$str = ''.str_replace("\n", "
", $help).'';
return $str;
}
// 파일을 업로드 함
function upload_file($srcfile, $destfile, $dir)
{
if ($destfile == "") return false;
// 업로드 한후 , 퍼미션을 변경함
@move_uploaded_file($srcfile, $dir.'/'.$destfile);
@chmod($dir.'/'.$destfile, G5_FILE_PERMISSION);
return true;
}
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'); }
}
}
// 메타태그를 이용한 URL 이동
// header("location:URL") 을 대체
function goto_url_top($url)
{
$url = str_replace("&", "&", $url);
//echo "";
if (!headers_sent())
header('Location: '.$url);
else {
echo '';
echo '';
}
exit;
}
// 로고 정보 가져오기
function get_logo() {
global $g5;
$logo = sql_fetch("select cs_value from {$g5['css_table']} where cs_name = 'logo'");
return $logo['cs_value'];
}
// 스타일 가져오기
function get_style($code, $field = '*') {
global $g5;
if(!$field) $field = " * ";
$result = sql_fetch("select ".$field." from {$g5['css_table']} where cs_name = '".$code."'");
return $result;
}
// 사이트 화면 디자인 가져오기
function get_site_content($co_id) {
global $g5, $config, $is_member;
$result = "";
$co = sql_fetch( " select * from {$g5['content_table']} where co_id = '{$co_id}' ");
$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 .= "".$pc_str."
";
} else {
$result .= $pc_str;
}
}
if($co['co_mobile_content']) {
$result .= "".$mo_str."
";
}
return $result;
}
function emote_ev($comment) {
global $g5;
$emo_result = sql_query("select * from {$g5['emoticon_table']}");
$str = $comment;
for($i=0; $row=sql_fetch_array($emo_result); $i++) {
$str = str_replace($row['me_text'], "
" ,$str);
}
return $str;
}
function have_jongsung ($chr) {
static $no_jongsung = "가갸거겨고교구규그기개걔게계과괘궈궤괴귀긔까꺄꺼껴꼬꾜꾸뀨끄끼깨꺠께꼐꽈꽤꿔꿰꾀뀌끠나냐너녀노뇨누뉴느니내냬네녜놔놰눠눼뇌뉘늬다댜더뎌도됴두듀드디대댸데뎨돠돼둬뒈되뒤듸따땨떠뗘또뚀뚜뜌뜨띠때떄떼뗴똬뙈뚸뛔뙤뛰띄라랴러려로료루류르리래럐레례롸뢔뤄뤠뢰뤼릐마먀머며모묘무뮤므미매먜메몌뫄뫠뭐뭬뫼뮈믜바뱌버벼보뵤부뷰브비배뱨베볘봐봬붜붸뵈뷔븨빠뺘뻐뼈뽀뾰뿌쀼쁘삐빼뺴뻬뼤뽜뽸뿨쀄뾔쀠쁴사샤서셔소쇼수슈스시새섀세셰솨쇄숴쉐쇠쉬싀싸쌰써쎠쏘쑈쑤쓔쓰씨쌔썌쎄쎼쏴쐐쒀쒜쐬쒸씌아야어여오요우유으이애얘에예와왜워웨외위의자쟈저져조죠주쥬즈지재쟤제졔좌좨줘줴죄쥐즤짜쨔쩌쪄쪼쬬쭈쮸쯔찌째쨰쩨쪠쫘쫴쭤쮀쬐쮜쯰차챠처쳐초쵸추츄츠치채챼체쳬촤쵀춰췌최취츼카캬커켜코쿄쿠큐크키캐컈케켸콰쾌쿼퀘쾨퀴킈타탸터텨토툐투튜트티태턔테톄톼퇘퉈퉤퇴튀틔파퍄퍼펴포표푸퓨프피패퍠페폐퐈퐤풔풰푀퓌픠하햐허혀호효후휴흐히해햬헤혜화홰훠훼회휘희2459";
return strpos($no_jongsung, $chr) === false ? true : false;
}
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;
}
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;
}
?>