그누보드 5.1.0 테마 지원버전

This commit is contained in:
chicpro
2015-08-03 15:44:15 +09:00
parent d49200c99e
commit 6beff3a333
280 changed files with 14787 additions and 344 deletions

View File

@ -12,11 +12,30 @@ if (!get_session('ss_admin')) {
// 스킨디렉토리를 SELECT 형식으로 얻음
function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
{
$skins = get_skin_dir($skin_gubun);
global $config;
$skins = array();
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
$dirs = get_skin_dir($skin_gubun, G5_THEME_PATH.'/'.G5_SKIN_DIR);
if(!empty($dirs)) {
foreach($dirs as $dir) {
$skins[] = 'theme/'.$dir;
}
}
}
$skins = array_merge($skins, get_skin_dir($skin_gubun));
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
for ($i=0; $i<count($skins); $i++) {
if ($i == 0) $str .= "<option value=\"\">선택</option>";
$str .= option_selected($skins[$i], $selected);
if(preg_match('#^theme/(.+)$#', $skins[$i], $match))
$text = '(테마) '.$match[1];
else
$text = $skins[$i];
$str .= option_selected($skins[$i], $selected, $text);
}
$str .= "</select>";
return $str;
@ -25,11 +44,30 @@ function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
// 모바일 스킨디렉토리를 SELECT 형식으로 얻음
function get_mobile_skin_select($skin_gubun, $id, $name, $selected='', $event='')
{
$skins = get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
global $config;
$skins = array();
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
$dirs = get_skin_dir($skin_gubun, G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR);
if(!empty($dirs)) {
foreach($dirs as $dir) {
$skins[] = 'theme/'.$dir;
}
}
}
$skins = array_merge($skins, get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR));
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
for ($i=0; $i<count($skins); $i++) {
if ($i == 0) $str .= "<option value=\"\">선택</option>";
$str .= option_selected($skins[$i], $selected);
if(preg_match('#^theme/(.+)$#', $skins[$i], $match))
$text = '(테마) '.$match[1];
else
$text = $skins[$i];
$str .= option_selected($skins[$i], $selected, $text);
}
$str .= "</select>";
return $str;
@ -44,6 +82,9 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
$result_array = array();
$dirname = $skin_path.'/'.$skin.'/';
if(!is_dir($dirname))
return;
$handle = opendir($dirname);
while ($file = readdir($handle)) {
if($file == '.'||$file == '..') continue;
@ -57,6 +98,101 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
}
// 테마
function get_theme_dir()
{
$result_array = array();
$dirname = G5_PATH.'/'.G5_THEME_DIR.'/';
$handle = opendir($dirname);
while ($file = readdir($handle)) {
if($file == '.'||$file == '..') continue;
if (is_dir($dirname.$file)) {
$theme_path = $dirname.$file;
if(is_file($theme_path.'/index.php') && is_file($theme_path.'/head.php') && is_file($theme_path.'/tail.php'))
$result_array[] = $file;
}
}
closedir($handle);
natsort($result_array);
return $result_array;
}
// 테마정보
function get_theme_info($dir)
{
$info = array();
$path = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir;
if(is_dir($path)) {
$screenshot = $path.'/screenshot.png';
if(is_file($screenshot)) {
$size = @getimagesize($screenshot);
if($size[2] == 3)
$screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot);
}
$info['screenshot'] = $screenshot_url;
$text = $path.'/readme.txt';
if(is_file($text)) {
$content = file($text, false);
$content = array_map('trim', $content);
preg_match('#^Theme Name:(.+)$#i', $content[0], $m0);
preg_match('#^Theme URI:(.+)$#i', $content[1], $m1);
preg_match('#^Maker:(.+)$#i', $content[2], $m2);
preg_match('#^Maker URI:(.+)$#i', $content[3], $m3);
preg_match('#^Version:(.+)$#i', $content[4], $m4);
preg_match('#^Detail:(.+)$#i', $content[5], $m5);
preg_match('#^License:(.+)$#i', $content[6], $m6);
preg_match('#^License URI:(.+)$#i', $content[7], $m7);
$info['theme_name'] = trim($m0[1]);
$info['theme_uri'] = trim($m1[1]);
$info['maker'] = trim($m2[1]);
$info['maker_uri'] = trim($m3[1]);
$info['version'] = trim($m4[1]);
$info['detail'] = trim($m5[1]);
$info['license'] = trim($m6[1]);
$info['license_uri'] = trim($m7[1]);
}
if(!$info['theme_name'])
$info['theme_name'] = $dir;
}
return $info;
}
// 테마설정 정보
function get_theme_config_value($dir, $key='*')
{
$tconfig = array();
$theme_config_file = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir.'/theme.config.php';
if(is_file) {
include($theme_config_file);
if($key == '*') {
$tconfig = $theme_config;
} else {
$keys = array_map('trim', explode(',', $key));
foreach($keys as $v) {
$tconfig[$v] = trim($theme_config[$v]);
}
}
}
return $tconfig;
}
// 회원권한을 SELECT 형식으로 얻음
function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="")
{
@ -95,26 +231,48 @@ function get_member_id_select($name, $level, $selected="", $event="")
}
// 권한 검사
function auth_check($auth, $attr)
function auth_check($auth, $attr, $return=false)
{
global $is_admin;
if ($is_admin == 'super') return;
if (!trim($auth))
alert('이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.');
if (!trim($auth)) {
$msg = '이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.';
if($return)
return $msg;
else
alert($msg);
}
$attr = strtolower($attr);
if (!strstr($auth, $attr)) {
if ($attr == 'r')
alert('읽을 권한이 없습니다.');
else if ($attr == 'w')
alert('입력, 추가, 생성, 수정 권한이 없습니다.');
else if ($attr == 'd')
alert('삭제 권한이 없습니다.');
else
alert('속성이 잘못 되었습니다.');
if ($attr == 'r') {
$msg = '읽을 권한이 없습니다.';
if($return)
return $msg;
else
alert($msg);
} else if ($attr == 'w') {
$msg = '입력, 추가, 생성, 수정 권한이 없습니다.';
if($return)
return $msg;
else
alert($msg);
} else if ($attr == 'd') {
$msg = '삭제 권한이 없습니다.';
if($return)
return $msg;
else
alert($msg);
} else {
$msg = '속성이 잘못 되었습니다.';
if($return)
return $msg;
else
alert($msg);
}
}
}

View File

@ -3,6 +3,7 @@ $menu['menu100'] = array (
array('100000', '환경설정', G5_ADMIN_URL.'/config_form.php', 'config'),
array('', '기본환경설정', G5_ADMIN_URL.'/config_form.php', 'cf_basic'),
array('', '관리권한설정', G5_ADMIN_URL.'/auth_list.php', 'cf_auth'),
array('', '테마설정', G5_ADMIN_URL.'/theme.php', 'cf_theme', 1),
array('', '메뉴설정', G5_ADMIN_URL.'/menu_list.php', 'cf_menu', 1),
array('100300', '메일 테스트', G5_ADMIN_URL.'/sendmail_test.php', 'cf_mailtest'),
array('100310', '팝업레이어관리', G5_ADMIN_URL.'/newwinlist.php', 'scf_poplayer'),

View File

@ -153,10 +153,9 @@ $pg_anchor = '<ul class="anchor">
$frm_submit = '<div class="btn_confirm01 btn_confirm">
<input type="submit" value="확인" class="btn_submit" accesskey="s">
<a href="./board_list.php?'.$qstr.'">목록</a>'.PHP_EOL;
if ($w == 'u') $frm_submit .= ' <a href="./board_copy.php?bo_table='.$bo_table.'" id="board_copy" target="win_board_copy">게시판복사</a>
if ($w == 'u') $frm_submit .= '<a href="./board_copy.php?bo_table='.$bo_table.'" id="board_copy" target="win_board_copy">게시판복사</a>
<a href="'.G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'" class="btn_frmline">게시판 바로가기</a>
<a href="./board_thumbnail_delete.php?bo_table='.$board['bo_table'].'&amp;'.$qstr.'" onclick="return delete_confirm2(\'게시판 썸네일 파일을 삭제하시겠습니까?\');">게시판 썸네일 삭제</a>
'.PHP_EOL;
<a href="./board_thumbnail_delete.php?bo_table='.$board['bo_table'].'&amp;'.$qstr.'" onclick="return delete_confirm2(\'게시판 썸네일 파일을 삭제하시겠습니까?\');">게시판 썸네일 삭제</a>'.PHP_EOL;
$frm_submit .= '</div>';
?>
@ -1118,7 +1117,7 @@ $frm_submit .= '</div>';
</div>
</section>
<?php echo $frm_submit; ?>
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_galc">테마 이미지설정 가져오기</button></div>', $frm_submit); ?>
<section id="anc_bo_point">
<h2 class="h2_frm">게시판 포인트 설정</h2>
@ -1240,6 +1239,37 @@ $(function(){
window.open(this.href, "win_board_copy", "left=10,top=10,width=500,height=400");
return false;
});
$(".get_theme_galc").on("click", function() {
if(!confirm("현재 테마의 게시판 이미지 설정을 적용하시겠습니까?"))
return false;
$.ajax({
type: "POST",
url: "./theme_config_load.php",
cache: false,
async: false,
data: { type: "board" },
dataType: "json",
success: function(data) {
if(data.error) {
alert(data.error);
return false;
}
var field = Array('bo_gallery_cols', 'bo_gallery_width', 'bo_gallery_height', 'bo_mobile_gallery_width', 'bo_mobile_gallery_height', 'bo_image_width');
var count = field.length;
var key;
for(i=0; i<count; i++) {
key = field[i];
if(data[key] != undefined && data[key] != "")
$("input[name="+key+"]").val(data[key]);
}
}
});
});
});
function board_copy(bo_table) {

View File

@ -9,12 +9,9 @@ $token = get_token();
if ($is_admin != 'super')
alert('최고관리자만 접근 가능합니다.');
if (!isset($config['cf_include_index'])) {
if (!isset($config['cf_add_script'])) {
sql_query(" ALTER TABLE `{$g5['config_table']}`
ADD `cf_include_index` VARCHAR(255) NOT NULL AFTER `cf_admin`,
ADD `cf_include_head` VARCHAR(255) NOT NULL AFTER `cf_include_index`,
ADD `cf_include_tail` VARCHAR(255) NOT NULL AFTER `cf_include_head`,
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_include_tail` ", true);
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_admin_email_name` ", true);
}
if (!isset($config['cf_mobile_new_skin'])) {
@ -341,105 +338,41 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
<tr>
<th scope="row"><label for="cf_new_skin">최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_new_skin" id="cf_new_skin" required class="required">
<?php
$arr = get_skin_dir('new');
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_new_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_skin_select('new', 'cf_new_skin', 'cf_new_skin', $config['cf_new_skin'], 'required'); ?>
</td>
<th scope="row"><label for="cf_mobile_new_skin">모바일<br>최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_mobile_new_skin" id="cf_mobile_new_skin" required class="required">
<?php
$arr = get_skin_dir('new', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_new_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_mobile_skin_select('new', 'cf_mobile_new_skin', 'cf_mobile_new_skin', $config['cf_mobile_new_skin'], 'required'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="cf_search_skin">검색 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_search_skin" id="cf_search_skin" required class="required">
<?php
$arr = get_skin_dir('search');
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_search_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_skin_select('search', 'cf_search_skin', 'cf_search_skin', $config['cf_search_skin'], 'required'); ?>
</td>
<th scope="row"><label for="cf_mobile_search_skin">모바일 검색 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_mobile_search_skin" id="cf_mobile_search_skin" required class="required">
<?php
$arr = get_skin_dir('search', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_search_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_mobile_skin_select('search', 'cf_mobile_search_skin', 'cf_mobile_search_skin', $config['cf_mobile_search_skin'], 'required'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="cf_connect_skin">접속자 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_connect_skin" id="cf_connect_skin" required class="required">
<?php
$arr = get_skin_dir('connect');
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_connect_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_skin_select('connect', 'cf_connect_skin', 'cf_connect_skin', $config['cf_connect_skin'], 'required'); ?>
</td>
<th scope="row"><label for="cf_mobile_connect_skin">모바일 접속자 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_mobile_connect_skin" id="cf_mobile_connect_skin" required class="required">
<?php
$arr = get_skin_dir('connect', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_connect_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_mobile_skin_select('connect', 'cf_mobile_connect_skin', 'cf_mobile_connect_skin', $config['cf_mobile_connect_skin'], 'required'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="cf_faq_skin">FAQ 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_faq_skin" id="cf_faq_skin" required class="required">
<?php
$arr = get_skin_dir('faq');
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_faq_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_skin_select('faq', 'cf_faq_skin', 'cf_faq_skin', $config['cf_faq_skin'], 'required'); ?>
</td>
<th scope="row"><label for="cf_mobile_faq_skin">모바일 FAQ 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_mobile_faq_skin" id="cf_mobile_faq_skin" required class="required">
<?php
$arr = get_skin_dir('faq', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_faq_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
}
?>
</select>
<?php echo get_mobile_skin_select('faq', 'cf_mobile_faq_skin', 'cf_mobile_faq_skin', $config['cf_mobile_faq_skin'], 'required'); ?>
</td>
</tr>
<tr>
@ -532,7 +465,7 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
</div>
</section>
<?php echo $frm_submit; ?>
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_confc" data-type="conf_skin">테마 스킨설정 가져오기</button></div>', $frm_submit); ?>
<section id="anc_cf_board">
<h2 class="h2_frm">게시판 기본 설정</h2>
@ -636,27 +569,11 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
<tr>
<th scope="row"><label for="cf_member_skin">회원 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_member_skin" id="cf_member_skin" required class="required">
<?php
$arr = get_skin_dir('member');
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo '<option value="'.$arr[$i].'"'.get_selected($config['cf_member_skin'], $arr[$i]).'>'.$arr[$i].'</option>'."\n";
}
?>
</select>
<?php echo get_skin_select('member', 'cf_member_skin', 'cf_member_skin', $config['cf_member_skin'], 'required'); ?>
</td>
<th scope="row"><label for="cf_mobile_member_skin">모바일<br>회원 스킨<strong class="sound_only">필수</strong></label></th>
<td>
<select name="cf_mobile_member_skin" id="cf_mobile_member_skin" required class="required">
<?php
$arr = get_skin_dir('member', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
for ($i=0; $i<count($arr); $i++) {
if ($i == 0) echo "<option value=\"\">선택</option>";
echo '<option value="'.$arr[$i].'"'.get_selected($config['cf_mobile_member_skin'], $arr[$i]).'>'.$arr[$i].'</option>'."\n";
}
?>
</select>
<?php echo get_mobile_skin_select('member', 'cf_mobile_member_skin', 'cf_mobile_member_skin', $config['cf_mobile_member_skin'], 'required'); ?>
</td>
</tr>
<tr>
@ -761,7 +678,7 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
</div>
</section>
<?php echo $frm_submit; ?>
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_confc" data-type="conf_member">테마 회원스킨설정 가져오기</button></div>', $frm_submit); ?>
<section id="anc_cf_cert">
<h2 class="h2_frm">본인확인 설정</h2>
@ -1082,27 +999,6 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
<col>
</colgroup>
<tbody>
<tr>
<th scope="row"><label for="cf_include_index">초기화면 파일 경로</label></th>
<td>
<?php echo help('입력이 없으면 index.php가 초기화면 파일로 설정됩니다.<br>초기화면 파일은 index.php 파일과 동일한 위치에 존재해야 합니다.') ?>
<input type="text" name="cf_include_index" value="<?php echo $config['cf_include_index'] ?>" id="cf_include_index" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_include_head">상단 파일 경로</label></th>
<td>
<?php echo help('입력이 없으면 head.php가 상단 파일로 설정됩니다.<br>상단 파일은 head.php 파일과 동일한 위치에 존재해야 합니다.') ?>
<input type="text" name="cf_include_head" value="<?php echo $config['cf_include_head'] ?>" id="cf_include_head" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_include_tail">하단 파일 경로</label></th>
<td>
<?php echo help('입력이 없으면 tail.php가 하단 파일로 설정됩니다.<br>초기화면 파일은 tail.php 파일과 동일한 위치에 존재해야 합니다.') ?>
<input type="text" name="cf_include_tail" value="<?php echo $config['cf_include_tail'] ?>" id="cf_include_tail" class="frm_input" size="50">
</td>
</tr>
<tr>
<th scope="row"><label for="cf_add_script">추가 script, css</label></th>
<td>
@ -1250,6 +1146,42 @@ $(function(){
break;
}
});
$(".get_theme_confc").on("click", function() {
var type = $(this).data("type");
var msg = "기본환경 스킨 설정";
if(type == "conf_member")
msg = "기본환경 회원스킨 설정";
if(!confirm("현재 테마의 "+msg+"을 적용하시겠습니까?"))
return false;
$.ajax({
type: "POST",
url: "./theme_config_load.php",
cache: false,
async: false,
data: { type: type },
dataType: "json",
success: function(data) {
if(data.error) {
alert(data.error);
return false;
}
var field = Array('cf_member_skin', 'cf_mobile_member_skin', 'cf_new_skin', 'cf_mobile_new_skin', 'cf_search_skin', 'cf_mobile_search_skin', 'cf_connect_skin', 'cf_mobile_connect_skin', 'cf_faq_skin', 'cf_mobile_faq_skin');
var count = field.length;
var key;
for(i=0; i<count; i++) {
key = field[i];
if(data[key] != undefined && data[key] != "")
$("select[name="+key+"]").val(data[key]);
}
}
});
});
});
function fconfigform_submit(f)

View File

@ -29,9 +29,6 @@ $sql = " update {$g5['config_table']}
cf_admin = '{$_POST['cf_admin']}',
cf_admin_email = '{$_POST['cf_admin_email']}',
cf_admin_email_name = '{$_POST['cf_admin_email_name']}',
cf_include_index = '{$_POST['cf_include_index']}',
cf_include_head = '{$_POST['cf_include_head']}',
cf_include_tail = '{$_POST['cf_include_tail']}',
cf_add_script = '{$_POST['cf_add_script']}',
cf_use_point = '{$_POST['cf_use_point']}',
cf_point_term = '{$_POST['cf_point_term']}',

View File

@ -714,3 +714,37 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
.sevice_2 .svc_sms .svc_btn a{display:inline-block; background:#f8f8f8;width:100%;text-align:center;margin:0;padding:10px 0 0 }
.sevice_2 .svc_design{overflow:hidden;height:210px;position:relative}
.sevice_2 .svc_design .svc_btn a{margin:0 0 20px}
/*테마*/
.theme_p{padding:0 20px}
#theme_list{padding:0;margin:0 10px;list-style:none; width: 1000px;position:relative}
#theme_list:after{display:block;visibility:hidden;clear:both;content:""}
#theme_list li{padding:10px;margin:0;float:left;width:302px}
#theme_list li:after{display:block;visibility:hidden;clear:both;content:""}
#theme_list li .tmli_if{border: 1px solid #d1dee2;width:300px;}
#theme_list li .tmli_if>img{width:300px;height:225px;}
#theme_list li .tmli_if:hover>img{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter: alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}
#theme_list li .tmli_tit{position:relative; border-top: 1px solid #d1dee2; background: #e5ecef;}
#theme_list li .tmli_tit p{height:40px;line-height:40px;padding:0 10px 0;font-weight:bold;text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
#theme_list li .tmli_tit button.tmli_dt{position:absolute;top:8px;right:10px;padding:5px;background:#111;color:#fff;display:none;border:none}
#theme_list li .tmli_if:hover button.tmli_dt{display:block}
#theme_list li .theme_sl{float:left;border:none;margin-top:5px;padding:0 5px;height:26px;background:#999;color:#fff}
#theme_list li .theme_sl:hover{background:#ff3061}
#theme_list li .theme_deactive{margin-left:4px}
#theme_list li .theme_sl_use{background:#ff3061;line-height:26px}
#theme_list li .theme_pr{float:right;margin-top:5px;padding:0 5px;height:24px;line-height:24px; border: 1px solid #ccc; background: #fafafa; }
#theme_list li .theme_preview{ float: right; margin-top: 5px; padding:0 5px;height:26px; border: 1px solid #ccc; background: #fafafa; margin-right:3px}
#theme_detail{position:fixed;_position:absolute;top:50%;left:20px;_top:300px;width:950px;height:490px;margin-top:-245px;background:#fff;border:1px solid #000;z-index:99999;}
#theme_detail .thdt_img{padding:20px 0 20px 20px;float:left;}
#theme_detail .thdt_img img{width:600px;height:450px;}
#theme_detail .thdt_if{float:right;width:290px;padding:40px 20px 0 0;position:relative}
#theme_detail .thdt_if h2{padding:0 ;margin:0}
#theme_detail .thdt_if p{font-weight:normal;padding:10px;background:#f5f5f5;height:250px;overflow-y:auto;}
#theme_detail .thdt_if a{vertical-align:middle;}
#theme_detail .thdt_if .thdt_home{background:url(../img/link_icon.gif) no-repeat bottom right;padding-right:13px;}
#theme_detail .close_btn{position:absolute;top:10px;right:10px;background:url(../img/close.gif) no-repeat 50% 50%;border:none;width:30px;height:30px;overflow:hidden;text-indent:-9999px;}
#theme_detail table{border-collapse:collapse;margin:5px 0 10px}
#theme_detail table th{padding: 5px 0; border: 1px solid #d1dee2; background: #e5ecef;width:50px;padding:10px;text-align:left}
#theme_detail table td{ border: 1px solid #ececec;padding:10px}
.no_theme{text-align:center;padding:100px 0;color:#555}

8
adm/css/theme.css Normal file
View File

@ -0,0 +1,8 @@
@charset "utf-8";
#preview_item{height:50px}
#preview_item ul{margin:0;padding:0;top:0;width:100%;border-bottom:1px solid #eee; margin:0 auto;text-align:center;background:#333;position:fixed;top:0;z-index:999999;width:100%;}
#preview_item ul li{list-style:none;display:inline-block;height:50px;line-height:50px;padding:0 3px;*display:inline; zoom:1;}
#preview_item ul li a{color:#555;padding:0 8px;height:24px;line-height:24px;background:#f2f2f2;border-radius:3px;display:inline-block;vertical-align:middle;border:1px solid #dcdcdc;}
#preview_item ul li a:hover{background:#ccc;text-decoration:none;border:1px solid #ccc;}
#preview_item ul li button{color:#fff;padding:0 8px;background:#FF5191;border-radius:3px;height:26px;line-height:24px;vertical-align:middle;border:none}
#preview_item ul li button:hover{background:#e40d5c;color:#fff;text-decoration:none;}

View File

@ -8,7 +8,7 @@ auth_check($auth[$sub_menu], "w");
$sql = " select * from {$g5['faq_master_table']} where fm_id = '$fm_id' ";
$fm = sql_fetch($sql);
$html_title = 'FAQ '.$fm['fm_subject'];;
$html_title = 'FAQ '.$fm['fm_subject'];
if ($w == "u")
{

BIN
adm/img/close.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
adm/img/link_icon.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 B

BIN
adm/img/theme_img.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -52,14 +52,14 @@ $(function() {
);
});
$("#add_manual").live("click", function() {
$(document).on("click", "#add_manual", function() {
var me_name = $.trim($("#me_name").val());
var me_link = $.trim($("#me_link").val());
add_menu_list(me_name, me_link, "<?php echo $code; ?>");
});
$(".add_select").live("click", function() {
$(document).on("click", ".add_select", function() {
var me_name = $.trim($(this).siblings("input[name='subject[]']").val());
var me_link = $.trim($(this).siblings("input[name='link[]']").val());

View File

@ -136,12 +136,12 @@ $colspan = 7;
<script>
$(function() {
$(".btn_add_submenu").live("click", function() {
$(document).on("click", ".btn_add_submenu", function() {
var code = $(this).closest("tr").find("input[name='code[]']").val().substr(0, 2);
add_submenu(code);
});
$(".btn_del_menu").live("click", function() {
$(document).on("click", ".btn_del_menu", function() {
if(!confirm("메뉴를 삭제하시겠습니까?"))
return false;

80
adm/theme.js Normal file
View File

@ -0,0 +1,80 @@
$(function() {
$(".theme_active").on("click", function() {
var theme = $(this).data("theme");
var name = $(this).data("name");
if(!confirm(name+" 테마를 적용하시겠습니까?"))
return false;
var set_default_skin = 0;
if($(this).data("set_default_skin") == true) {
if(confirm("기본환경설정, 1:1문의 스킨을 테마에서 설정된 스킨으로 변경하시겠습니까?\n\n변경을 선택하시면 테마에서 지정된 스킨으로 회원스킨 등이 변경됩니다."))
set_default_skin = 1;
}
$.ajax({
type: "POST",
url: "./theme_update.php",
data: {
"theme": theme,
"set_default_skin": set_default_skin
},
cache: false,
async: false,
success: function(data) {
if(data) {
alert(data);
return false;
}
document.location.reload();
}
});
});
$(".theme_deactive").on("click", function() {
var theme = $(this).data("theme");
var name = $(this).data("name");
if(!confirm(name+" 테마 사용설정을 해제하시겠습니까?\n\n테마 설정을 해제하셔도 게시판 등의 스킨은 변경되지 않으므로 개별 변경작업이 필요합니다."))
return false;
$.ajax({
type: "POST",
url: "./theme_update.php",
data: {
"theme": theme,
"type": "reset"
},
cache: false,
async: false,
success: function(data) {
if(data) {
alert(data);
return false;
}
document.location.reload();
}
});
});
$(".theme_preview").on("click", function() {
var theme = $(this).data("theme");
$("#theme_detail").remove();
$.ajax({
type: "POST",
url: "./theme_detail.php",
data: {
"theme": theme
},
cache: false,
async: false,
success: function(data) {
$("#theme_list").after(data);
}
});
});
});

77
adm/theme.php Normal file
View File

@ -0,0 +1,77 @@
<?php
$sub_menu = "100280";
include_once('./_common.php');
if ($is_admin != 'super')
alert('최고관리자만 접근 가능합니다.');
// 테마 필드 추가
if(!isset($config['cf_theme'])) {
sql_query(" ALTER TABLE `{$g5['config_table']}`
ADD `cf_theme` varchar(255) NOT NULL DEFAULT '' AFTER `cf_title` ", true);
}
$theme = get_theme_dir();
if($config['cf_theme'] && in_array($config['cf_theme'], $theme))
array_unshift($theme, $config['cf_theme']);
$theme = array_values(array_unique($theme));
$total_count = count($theme);
// 설정된 테마가 존재하지 않는다면 cf_theme 초기화
if($config['cf_theme'] && !in_array($config['cf_theme'], $theme))
sql_query(" update {$g5['config_table']} set cf_theme = '' ");
$g5['title'] = "테마설정";
include_once('./admin.head.php');
?>
<script src="<?php echo G5_ADMIN_URL; ?>/theme.js"></script>
<p class="theme_p">설치된 테마 : <?php echo number_format($total_count); ?></p>
<?php if($total_count > 0) { ?>
<ul id="theme_list">
<?php
for($i=0; $i<$total_count; $i++) {
$info = get_theme_info($theme[$i]);
$name = get_text($info['theme_name']);
if($info['screenshot'])
$screenshot = '<img src="'.$info['screenshot'].'" alt="'.$name.'">';
else
$screenshot = '<img src="'.G5_ADMIN_URL.'/img/theme_img.jpg" alt="">';
if($config['cf_theme'] == $theme[$i]) {
$btn_active = '<span class="theme_sl theme_sl_use">사용중</span><button type="button" class="theme_sl theme_deactive" data-theme="'.$theme[$i].'" '.'data-name="'.$name.'">사용안함</button>';
} else {
$tconfig = get_theme_config_value($theme[$i], 'set_default_skin');
if($tconfig['set_default_skin'])
$set_default_skin = 'true';
else
$set_default_skin = 'false';
$btn_active = '<button type="button" class="theme_sl theme_active" data-theme="'.$theme[$i].'" '.'data-name="'.$name.'" data-set_default_skin="'.$set_default_skin.'">테마적용</button>';
}
?>
<li>
<div class="tmli_if">
<?php echo $screenshot; ?>
<div class="tmli_tit">
<p><?php echo get_text($info['theme_name']); ?></p>
</div>
</div>
<?php echo $btn_active; ?>
<a href="./theme_preview.php?theme=<?php echo $theme[$i]; ?>" class="theme_pr" target="theme_preview">미리보기</a>
<button type="button" class="tmli_dt theme_preview" data-theme="<?php echo $theme[$i]; ?>">상세보기</button>
</li>
<?php
}
?>
</ul>
<?php } else { ?>
<p class="no_theme">설치된 테마가 없습니다.</p>
<?php } ?>
<?php
include_once ('./admin.tail.php');
?>

78
adm/theme_config_load.php Normal file
View File

@ -0,0 +1,78 @@
<?php
$sub_menu = "300100";
include_once('./_common.php');
include_once(G5_LIB_PATH.'/json.lib.php');
$data = array();
$data['error'] = '';
$data['error'] = auth_check($auth[$sub_menu], 'w', true);
if($data['error'])
die(json_encode($data));
if(!$config['cf_theme']) {
$data['error'] = '사용 중인 테마가 없습니다.';
die(json_encode($data));
}
$theme_dir = get_theme_dir();
if(!in_array($config['cf_theme'], $theme_dir)) {
$data['error'] = $config['cf_theme'].' 테마는 설치된 테마가 아닙니다.';
die(json_encode($data));
}
$type = $_POST['type'];
$arr_type = array('board', 'conf_skin', 'conf_member');
if(!in_array($type, $arr_type)) {
$data['error'] = '올바른 방법으로 이용해 주십시오.';
die(json_encode($data));
}
if($type == 'board') {
$keys = array('bo_gallery_cols', 'bo_gallery_width', 'bo_gallery_height', 'bo_mobile_gallery_width', 'bo_mobile_gallery_height', 'bo_image_width');
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
$i = 0;
foreach($keys as $val) {
if($tconfig[$val]) {
$data[$val] = (int)preg_replace('#[^0-9]#', '', $tconfig[$val]);
$i++;
}
}
if($i == 0)
$data['error'] = '적용할 게시판 이미지 설정이 없습니다.';
} else if($type == 'conf_skin') {
$keys = array('cf_new_skin', 'cf_mobile_new_skin', 'cf_search_skin', 'cf_mobile_search_skin', 'cf_connect_skin', 'cf_mobile_connect_skin', 'cf_faq_skin', 'cf_mobile_faq_skin');
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
$i = 0;
foreach($keys as $val) {
if($tconfig[$val]) {
$data[$val] = preg_match('#^theme/.+$#', $tconfig[$val]) ? $tconfig[$val] : 'theme/'.$tconfig[$val];
$i++;
}
}
if($i == 0)
$data['error'] = '적용할 기본환경 스킨 설정이 없습니다.';
} else if($type == 'conf_member') {
$keys = array('cf_member_skin', 'cf_mobile_member_skin');
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
$i = 0;
foreach($keys as $val) {
if($tconfig[$val]) {
$data[$val] = preg_match('#^theme/.+$#', $tconfig[$val]) ? $tconfig[$val] : 'theme/'.$tconfig[$val];
$i++;
}
}
if($i == 0)
$data['error'] = '적용할 기본환경 회원스킨 설정이 없습니다.';
}
die(json_encode($data));
?>

64
adm/theme_detail.php Normal file
View File

@ -0,0 +1,64 @@
<?php
$sub_menu = "100280";
include_once('./_common.php');
if ($is_admin != 'super')
die('최고관리자만 접근 가능합니다.');
$theme = trim($_POST['theme']);
$theme_dir = get_theme_dir();
if(!in_array($theme, $theme_dir))
die('선택하신 테마가 설치되어 있지 않습니다.');
$info = get_theme_info($theme);
if($info['screenshot'])
$screenshot = '<img src="'.$info['screenshot'].'" alt="'.$name.'">';
else
$screenshot = '<img src="'.G5_ADMIN_URL.'/img/theme_img.jpg" alt="">';
$name = get_text($info['theme_name']);
if($info['theme_uri']) {
$name = '<a href="'.set_http($info['theme_uri']).'" target="_blank" class="thdt_home">'.$name.'</a>';
}
$maker = get_text($info['maker']);
if($info['maker_uri']) {
$maker = '<a href="'.set_http($info['maker_uri']).'" target="_blank" class="thdt_home">'.$maker.'</a>';
}
$license = get_text($info['license']);
if($info['license_uri']) {
$license = '<a href="'.set_http($info['license_uri']).'" target="_blank" class="thdt_home">'.$license.'</a>';
}
?>
<div id="theme_detail">
<div class="thdt_img"><?php echo $screenshot; ?></div>
<div class="thdt_if">
<h2><?php echo $name; ?></h2>
<table>
<tr>
<th scope="row">Version</th>
<td><?php echo get_text($info['version']); ?></td>
</tr>
<tr>
<th scope="row">Maker</th>
<td><?php echo $maker; ?></td>
</tr>
<tr>
<th scope="row">License</th>
<td><?php echo $license; ?></td>
</tr>
</table>
<p><?php echo get_text($info['detail']); ?></p>
<button type="button" class="close_btn">닫기</button>
</div>
</div>
<script>
$(".close_btn").on("click", function() {
$("#theme_detail").remove();
});
</script>

118
adm/theme_preview.php Normal file
View File

@ -0,0 +1,118 @@
<?php
$sub_menu = "100280";
define('_THEME_PREVIEW_', true);
include_once('./_common.php');
$theme_dir = get_theme_dir();
if(!$theme || !in_array($theme, $theme_dir))
alert_close('테마가 존재하지 않거나 올바르지 않습니다.');
$info = get_theme_info($theme);
$arr_mode = array('index', 'list', 'view');
$mode = substr(strip_tags($_GET['mode']), 0, 20);
if(!in_array($mode, $arr_mode))
$mode = 'index';
$qstr_index = '&amp;mode=index';
$qstr_list = '&amp;mode=list';
$qstr_view = '&amp;mode=view';
$qstr_device = '&amp;mode='.$mode.'&amp;device='.(G5_IS_MOBILE ? 'pc' : 'mobile');
$sql = " select bo_table, wr_parent from {$g5['board_new_table']} order by bn_id desc limit 1 ";
$row = sql_fetch($sql);
$bo_table = $row['bo_table'];
$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");
$write_table = $g5['write_prefix'] . $bo_table;
// theme.config.php 미리보기 게시판 스킨이 설정돼 있다면
$tconfig = get_theme_config_value($theme, 'set_default_skin, preview_board_skin, preview_mobile_board_skin');
if($mode == 'list' || $mode == 'view') {
if($tconfig['preview_board_skin'])
$board['bo_skin'] = preg_match('#^theme/.+$#', $tconfig['preview_board_skin']) ? $tconfig['preview_board_skin'] : 'theme/'.$tconfig['preview_board_skin'];
if($tconfig['preview_mobile_board_skin'])
$board['bo_mobile_skin'] = preg_match('#^theme/.+$#', $tconfig['preview_mobile_board_skin']) ? $tconfig['preview_mobile_board_skin'] : 'theme/'.$tconfig['preview_mobile_board_skin'];
}
// 스킨경로
if (G5_IS_MOBILE) {
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
$member_skin_path = get_skin_path('member', $config['cf_mobile_member_skin']);
$member_skin_url = get_skin_url('member', $config['cf_mobile_member_skin']);
$new_skin_path = get_skin_path('new', $config['cf_mobile_new_skin']);
$new_skin_url = get_skin_url('new', $config['cf_mobile_new_skin']);
$search_skin_path = get_skin_path('search', $config['cf_mobile_search_skin']);
$search_skin_url = get_skin_url('search', $config['cf_mobile_search_skin']);
$connect_skin_path = get_skin_path('connect', $config['cf_mobile_connect_skin']);
$connect_skin_url = get_skin_url('connect', $config['cf_mobile_connect_skin']);
$faq_skin_path = get_skin_path('faq', $config['cf_mobile_faq_skin']);
$faq_skin_url = get_skin_url('faq', $config['cf_mobile_faq_skin']);
} else {
$board_skin_path = get_skin_path('board', $board['bo_skin']);
$board_skin_url = get_skin_url('board', $board['bo_skin']);
$member_skin_path = get_skin_path('member', $config['cf_member_skin']);
$member_skin_url = get_skin_url('member', $config['cf_member_skin']);
$new_skin_path = get_skin_path('new', $config['cf_new_skin']);
$new_skin_url = get_skin_url('new', $config['cf_new_skin']);
$search_skin_path = get_skin_path('search', $config['cf_search_skin']);
$search_skin_url = get_skin_url('search', $config['cf_search_skin']);
$connect_skin_path = get_skin_path('connect', $config['cf_connect_skin']);
$connect_skin_url = get_skin_url('connect', $config['cf_connect_skin']);
$faq_skin_path = get_skin_path('faq', $config['cf_faq_skin']);
$faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
}
$conf = sql_fetch(" select cf_theme from {$g5['config_table']} ");
$name = get_text($info['theme_name']);
if($conf['cf_theme'] != $theme) {
if($tconfig['set_default_skin'])
$set_default_skin = 'true';
else
$set_default_skin = 'false';
$btn_active = '<li><button type="button" class="theme_sl theme_active" data-theme="'.$theme.'" '.'data-name="'.$name.'" data-set_default_skin="'.$set_default_skin.'">테마적용</button></li>';
} else {
$btn_active = '';
}
$g5['title'] = get_text($info['theme_name']).' 테마 미리보기';
require_once(G5_PATH.'/head.sub.php');
?>
<link rel="stylesheet" href="<?php echo G5_ADMIN_URL; ?>/css/theme.css">
<script src="<?php echo G5_ADMIN_URL; ?>/theme.js"></script>
<section id="preview_item">
<ul>
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_index; ?>">인덱스 화면</a></li>
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_list; ?>">게시글 리스트</a></li>
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_view; ?>">게시글 보기</a></li>
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_device; ?>"><?php echo (G5_IS_MOBILE ? 'PC 버전' : '모바일 버전'); ?></a></li>
<?php echo $btn_active; ?>
</ul>
</section>
<section id="preview_content">
<?php
switch($mode) {
case 'list':
include(G5_BBS_PATH.'/board.php');
break;
case 'view':
$wr_id = $row['wr_parent'];
$write = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
include(G5_BBS_PATH.'/board.php');
break;
default:
include(G5_PATH.'/index.php');
break;
}
?>
</section>
<?php
require_once(G5_PATH.'/tail.sub.php');
?>

70
adm/theme_update.php Normal file
View File

@ -0,0 +1,70 @@
<?php
$sub_menu = "100280";
include_once('./_common.php');
if ($is_admin != 'super')
die('최고관리자만 접근 가능합니다.');
$theme = trim($_POST['theme']);
$theme_dir = get_theme_dir();
if($_POST['type'] == 'reset') {
$sql = " update {$g5['config_table']} set cf_theme = '' ";
sql_query($sql);
die('');
}
if(!in_array($theme, $theme_dir))
die('선택하신 테마가 설치되어 있지 않습니다.');
// 테마적용
$sql = " update {$g5['config_table']} set cf_theme = '$theme' ";
sql_query($sql);
// 테마 설정 스킨 적용
if($_POST['set_default_skin'] == 1) {
$keys = 'set_default_skin, cf_member_skin, cf_mobile_member_skin, cf_new_skin, cf_mobile_new_skin, cf_search_skin, cf_mobile_search_skin, cf_connect_skin, cf_mobile_connect_skin, cf_faq_skin, cf_mobile_faq_skin, qa_skin, qa_mobile_skin';
$tconfig = get_theme_config_value($theme, $keys);
if($tconfig['set_default_skin']) {
$sql_common = array();
$qa_sql_common = array();
foreach($tconfig as $key => $val) {
if(preg_match('#^qa_.+$#', $key)) {
if($val) {
if(!preg_match('#^theme/.+$#', $val))
$val = 'theme/'.$val;
$qa_sql_common[] = " $key = '$val' ";
}
continue;
}
if(!isset($config[$key]))
continue;
if($val) {
if(!preg_match('#^theme/.+$#', $val))
$val = 'theme/'.$val;
$sql_common[] = " $key = '$val' ";
}
}
if(!empty($sql_common)) {
$sql = " update {$g5['config_table']} set " . implode(', ', $sql_common);
sql_query($sql);
}
if(!empty($qa_sql_common)) {
$sql = " update {$g5['qa_config_table']} set " . implode(', ', $qa_sql_common);
sql_query($sql);
}
}
}
die('');
?>