diff --git a/adm/admin.lib.php b/adm/admin.lib.php index 38a1183f4..bc1ab9fcd 100644 --- a/adm/admin.lib.php +++ b/adm/admin.lib.php @@ -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 = ""; 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 = ""; 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); + } } } diff --git a/adm/admin.menu100.php b/adm/admin.menu100.php index 26bdda490..44f93712a 100644 --- a/adm/admin.menu100.php +++ b/adm/admin.menu100.php @@ -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'), diff --git a/adm/admin.menu300.php b/adm/admin.menu300.php index 1268109e0..65f848587 100644 --- a/adm/admin.menu300.php +++ b/adm/admin.menu300.php @@ -8,5 +8,6 @@ $menu['menu300'] = array ( array('300500', '1:1문의설정', ''.G5_ADMIN_URL.'/qa_config.php', 'qa'), array('300600', '내용관리', G5_ADMIN_URL.'/contentlist.php', 'scf_contents', 1), array('300700', 'FAQ관리', G5_ADMIN_URL.'/faqmasterlist.php', 'scf_faq', 1), + array('300820', '글,댓글 현황', G5_ADMIN_URL.'/write_count.php', 'scf_write_count'), ); ?> \ No newline at end of file diff --git a/adm/board_form.php b/adm/board_form.php index d40bd5756..1d3664147 100644 --- a/adm/board_form.php +++ b/adm/board_form.php @@ -153,10 +153,9 @@ $pg_anchor = '