AvocadoAmber/AvocadoEdition_Light/extend/community.config.php

327 lines
9.6 KiB
PHP
Raw Normal View History

2022-09-17 20:50:50 +09:00
<?php
2024-09-19 20:57:39 +09:00
if (!defined('_GNUBOARD_'))
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;
// 분류 옵션을 얻음
// 4.00 에서는 카테고리 테이블을 없애고 보드테이블에 있는 내용으로 대체
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;
$categories = explode("|", $board['bo_category_list']); // 구분자가 | 로 되어 있음
$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}&amp;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
}
// MMB LIST 이미지 가져오기
function get_mmb_image($bo_table, $wr_id)
{
2024-09-19 20:57:39 +09:00
global $g5, $config;
$filename = $alt = "";
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +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;
}
$thumb = array("src" => $src, "width" => $w, "height" => $h);
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(">", "&gt;", $str);
$str = str_replace("<", "&lt;", $str);
$str = str_replace("\"", "&quot;", $str);
$str = str_replace("&lt;br&gt;", "<br>", $str); //br은되게함
return $str;
2022-09-17 20:50:50 +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;
2022-09-17 20:50:50 +09:00
2024-09-19 20:57:39 +09:00
$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
}
// 메타태그를 이용한 URL 이동
// header("location:URL") 을 대체
function goto_url_top($url)
{
2024-09-19 20:57:39 +09:00
$url = str_replace("&amp;", "&", $url);
//echo "<script> location.replace('$url'); </script>";
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;
$logo = sql_fetch("select cs_value from {$g5['css_table']} where cs_name = 'logo'");
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 = " * ";
$result = sql_fetch("select " . $field . " from {$g5['css_table']} where cs_name = '" . $code . "'");
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 = "";
$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 .= "<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;
$emo_result = sql_query("select * from {$g5['emoticon_table']}");
$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
}