리빌더 부분 추가
This commit is contained in:
40
extend/rb_bbs.extend.php
Normal file
40
extend/rb_bbs.extend.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
/**
|
||||
* 지정된 경로의 폴더 목록을 <select> 태그로 반환
|
||||
*
|
||||
* @param string $path 폴더 경로
|
||||
* @param string $select_name 셀렉트 태그의 name 속성
|
||||
* @param string $select_id 셀렉트 태그의 id 속성
|
||||
* @param string|null $selected_folder 기본 선택된 폴더명
|
||||
* @return string <select> 태그 HTML 문자열
|
||||
*/
|
||||
function get_folder_list_select($path, $select_name = 'skin_name', $select_id = 'skin_id', $selected_folder = null) {
|
||||
|
||||
if ($selected_folder === null) {
|
||||
$selected_folder = '';
|
||||
}
|
||||
|
||||
// 결과 HTML 초기화
|
||||
$select_html = "<select name=\"$select_name\" id=\"$select_id\" class=\"select input_tiny w100\">\n";
|
||||
|
||||
// 디렉토리 확인
|
||||
if (is_dir($path)) {
|
||||
$folders = scandir($path);
|
||||
|
||||
foreach ($folders as $folder) {
|
||||
// '.'와 '..' 제외, 폴더인지 확인
|
||||
if ($folder !== '.' && $folder !== '..' && is_dir($path . '/' . $folder)) {
|
||||
$folder_escaped = htmlspecialchars($folder, ENT_QUOTES, 'UTF-8');
|
||||
$selected = ($folder === $selected_folder) ? ' selected' : '';
|
||||
$select_html .= "<option value=\"$folder_escaped\"$selected>$folder_escaped</option>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$select_html .= "<option value=\"\">스킨이 없습니다.</option>\n";
|
||||
}
|
||||
|
||||
$select_html .= "</select>\n";
|
||||
return $select_html;
|
||||
}
|
||||
1251
extend/rb_core.extend.php
Normal file
1251
extend/rb_core.extend.php
Normal file
File diff suppressed because it is too large
Load Diff
71
extend/rb_editor.extend.php
Normal file
71
extend/rb_editor.extend.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
if(isset($config['cf_editor']) && $config['cf_editor'] == "rb.editor") {
|
||||
|
||||
$rb_editor_url = G5_EDITOR_URL.'/'.$config['cf_editor'];
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/css/inc.skin.css">', 0);
|
||||
add_stylesheet('<link rel="stylesheet" href="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/css/inc.font.css">', 0);
|
||||
add_javascript('<script src="'.G5_EDITOR_URL.'/'.$config['cf_editor'].'/js/skin.js"></script>', 1);
|
||||
|
||||
|
||||
//수정시 이미지 스타일 손실을 막기위함
|
||||
add_event('html_purifier_config', function($config) {
|
||||
$add_html_tag = $config->getHTMLDefinition(true);
|
||||
|
||||
//$add_html_tag -> addElement('img', 'Inline', 'Empty', 'Common', ['src' => 'URI', 'alt' => 'Text','style' => 'Text']);
|
||||
$add_html_tag -> addElement('img', 'Block', 'Flow', 'Common', ['style' => 'Text']);
|
||||
$add_html_tag -> addElement('button', 'Block', 'Flow', 'Common', ['style' => 'Text']);
|
||||
$add_html_tag -> addElement('ul', 'Block', 'Flow', 'Common', ['style' => 'Text']);
|
||||
$add_html_tag -> addElement('mark', 'Block', 'Flow', 'Common', ['style' => 'Text']);
|
||||
$add_html_tag -> addElement('li', 'Block', 'Flow', 'Common', ['style' => 'Text']);
|
||||
$add_html_tag -> addElement('div', 'Block', 'Flow', 'Common', ['style' => 'Text', 'data-original-width' => 'Text', 'data-original-height' => 'Text']);
|
||||
|
||||
}, 1, 1);
|
||||
|
||||
|
||||
// get_view_thumbnail() 함수를 수정하지 않기위해 원본 내용을 저장함
|
||||
// 각 스킨에 $original_content = isset($view['content']) ? $view['content'] : ''; 를 추가하고
|
||||
// 아래 add_replace 로 복원함
|
||||
add_replace('get_view_thumbnail', function($contents) {
|
||||
global $original_content;
|
||||
|
||||
return preg_replace_callback(
|
||||
'/(<a[^>]+href=["\'][^"\']+view_image\.php\?fn=([^"\']+)["\'][^>]*>)?<img([^>]*)src="([^"]+thumb-[^"]+)"([^>]*)>(<\/a>)?/i',
|
||||
function($matches) use ($original_content) {
|
||||
|
||||
$a_open = isset($matches[1]) ? $matches[1] : '';
|
||||
$encoded_original_src = isset($matches[2]) ? urldecode($matches[2]) : '';
|
||||
$img_attrs_before = trim($matches[3]);
|
||||
$thumbnail_src = $matches[4];
|
||||
$img_attrs_after = trim($matches[5]);
|
||||
$a_close = isset($matches[6]) ? $matches[6] : '';
|
||||
|
||||
// 썸네일에서 원본이미지 유추 (만약 a태그가 있다면 여기서 추출한 URL을 우선 사용)
|
||||
if ($encoded_original_src) {
|
||||
$original_src = $encoded_original_src;
|
||||
} else {
|
||||
$original_src = preg_replace('/\/thumb-/', '/', $thumbnail_src);
|
||||
$original_src = preg_replace('/_(\d+)x(\d+)(\.\w+)$/i', '$3', $original_src);
|
||||
$original_src = preg_replace('/^https?:\/\/[^\/]+/', '', $original_src);
|
||||
}
|
||||
|
||||
// 원본 컨텐츠에서 정확한 이미지 스타일 추출
|
||||
$original_style = "";
|
||||
$escaped_original_src = preg_quote($original_src, '/');
|
||||
if (preg_match('/<img[^>]*src=["\'][^"\']*'.$escaped_original_src.'["\'][^>]*style=["\']([^"\']+)["\']/i', $original_content, $m)) {
|
||||
$original_style = $m[1];
|
||||
}
|
||||
|
||||
$style_attr = $original_style ? ' style="'.$original_style.'"' : '';
|
||||
|
||||
$new_img_tag = "<img src=\"{$thumbnail_src}\"{$style_attr} {$img_attrs_before} {$img_attrs_after}>";
|
||||
|
||||
return $a_open . $new_img_tag . $a_close;
|
||||
|
||||
}, $contents);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
12
extend/rb_memo.extend.php
Normal file
12
extend/rb_memo.extend.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
add_replace('admin_menu', 'add_admin_bbs_menu_memo', 1, 1); // 관리자 메뉴를 추가함
|
||||
|
||||
function add_admin_bbs_menu_memo($admin_menu){ // 메뉴추가
|
||||
|
||||
$admin_menu['menu000'][] = array(
|
||||
'000630', '쪽지 관리', G5_ADMIN_URL.'/rb/memo_form.php', 'rb_config',
|
||||
);
|
||||
return $admin_menu;
|
||||
}
|
||||
44
extend/rb_reservation.extend.php
Normal file
44
extend/rb_reservation.extend.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
add_replace('admin_menu', 'add_admin_bbs_menu_reservation', 0, 1); // 관리자 메뉴를 추가함
|
||||
|
||||
function add_admin_bbs_menu_reservation($admin_menu){ // 메뉴추가
|
||||
|
||||
$admin_menu['menu000'][] = array('000810', '티켓 관리', G5_ADMIN_URL.'/rb/reservation_list.php', 'rb_config');
|
||||
//$admin_menu['menu000'][] = array('000811', '예약 캘린더', G5_ADMIN_URL.'/rb/reservation_list_cal.php', 'rb_config');
|
||||
|
||||
$admin_menu['menu000'][] = array('000000', ' ', G5_ADMIN_URL, 'rb_config');
|
||||
return $admin_menu;
|
||||
}
|
||||
|
||||
$g5['rb_prefix'] = G5_TABLE_PREFIX.'rb_'; // 리빌더 테이블명 접두사
|
||||
$rb_reservation_table_name = $g5['rb_prefix'].'reservation'; // g5_rb_reservation
|
||||
|
||||
$rb_item_res = sql_fetch (" select * from {$rb_reservation_table_name} "); // 테이블 조회
|
||||
|
||||
// 사용하지 않는 페이지 리다이렉트 처리
|
||||
$redirect_map_reservation = [
|
||||
'/adm/shop_admin/itemform.php' => '/adm/rb/shop/itemform.php',
|
||||
];
|
||||
|
||||
// 현재 페이지의 URL을 확인 (쿼리 스트링을 제외한 경로)
|
||||
$current_urls_reservation = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
|
||||
// 쿼리 스트링을 확인 (파라미터)
|
||||
$query_string_reservation = $_SERVER['QUERY_STRING'];
|
||||
|
||||
// 만약 현재 URL이 배열의 키에 있으면, 해당 값으로 리다이렉트
|
||||
if (array_key_exists($current_urls_reservation, $redirect_map_reservation)) {
|
||||
// 리다이렉트할 URL에 쿼리 스트링을 붙여서 처리
|
||||
$redirect_urls_reservation = $redirect_map_reservation[$current_urls_reservation];
|
||||
|
||||
// 쿼리 스트링이 존재하면 '?'를 붙여서 추가
|
||||
if (!empty($query_string_reservation)) {
|
||||
$redirect_urls_reservation .= '?' . $query_string_reservation;
|
||||
}
|
||||
|
||||
// 리다이렉트 실행
|
||||
header('Location: ' . $redirect_urls_reservation);
|
||||
exit; // 리다이렉트 후 스크립트 실행 중지
|
||||
}
|
||||
269
extend/rb_shop.extend.php
Normal file
269
extend/rb_shop.extend.php
Normal file
@ -0,0 +1,269 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
// 크롭옵션을 사용하기위해 별도함수 사용
|
||||
function rb_it_image($it_id, $width, $height=0, $anchor=false, $img_id='', $img_alt='', $is_crop=true)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
if(!$it_id || !$width)
|
||||
return '';
|
||||
|
||||
$row = get_shop_item($it_id, true);
|
||||
|
||||
if(!$row['it_id'])
|
||||
return '';
|
||||
|
||||
$filename = $thumb = $img = '';
|
||||
|
||||
$img_width = 0;
|
||||
for($i=1;$i<=10; $i++) {
|
||||
$file = G5_DATA_PATH.'/item/'.$row['it_img'.$i];
|
||||
if(is_file($file) && $row['it_img'.$i]) {
|
||||
$size = @getimagesize($file);
|
||||
if(! isset($size[2]) || $size[2] < 1 || $size[2] > 3)
|
||||
continue;
|
||||
|
||||
$filename = basename($file);
|
||||
$filepath = dirname($file);
|
||||
$img_width = $size[0];
|
||||
$img_height = $size[1];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if($img_width && !$height) {
|
||||
$height = round(($width * $img_height) / $img_width);
|
||||
}
|
||||
|
||||
if($filename) {
|
||||
//thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop=false, $crop_mode='center', $is_sharpen=true, $um_value='80/0.5/3')
|
||||
$thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, $is_crop, 'center', false, $um_value='80/0.5/3');
|
||||
}
|
||||
|
||||
if($thumb) {
|
||||
$file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);
|
||||
$img = '<img src="'.$file_url.'" width="'.$width.'" height="'.$height.'" alt="'.$img_alt.'"';
|
||||
} else {
|
||||
$img = '<img src="'.G5_SHOP_URL.'/img/no_image.gif" width="'.$width.'"';
|
||||
if($height)
|
||||
$img .= ' height="'.$height.'"';
|
||||
$img .= ' alt="'.$img_alt.'"';
|
||||
}
|
||||
|
||||
if($img_id)
|
||||
$img .= ' id="'.$img_id.'"';
|
||||
$img .= '>';
|
||||
|
||||
if($anchor)
|
||||
$img = $img = '<a href="'.shop_item_url($it_id).'">'.$img.'</a>';
|
||||
|
||||
return run_replace('get_it_image_tag', $img, $thumb, $it_id, $width, $height, $anchor, $img_id, $img_alt, $is_crop);
|
||||
}
|
||||
|
||||
// 상품이미지 썸네일 생성
|
||||
function rb_it_thumbnail($img, $width, $height=0, $id='', $is_crop=true)
|
||||
{
|
||||
$str = '';
|
||||
|
||||
if ( $replace_tag = run_replace('get_it_thumbnail_tag', $str, $img, $width, $height, $id, $is_crop) ){
|
||||
return $replace_tag;
|
||||
}
|
||||
|
||||
$file = G5_DATA_PATH.'/item/'.$img;
|
||||
if(is_file($file))
|
||||
$size = @getimagesize($file);
|
||||
|
||||
if (! (isset($size) && is_array($size)))
|
||||
return '';
|
||||
|
||||
if($size[2] < 1 || $size[2] > 3)
|
||||
return '';
|
||||
|
||||
$img_width = $size[0];
|
||||
$img_height = $size[1];
|
||||
$filename = basename($file);
|
||||
$filepath = dirname($file);
|
||||
|
||||
if($img_width && !$height) {
|
||||
$height = round(($width * $img_height) / $img_width);
|
||||
}
|
||||
|
||||
$thumb = thumbnail($filename, $filepath, $filepath, $width, $height, false, $is_crop, 'center', false, $um_value='80/0.5/3');
|
||||
|
||||
if($thumb) {
|
||||
$file_url = str_replace(G5_PATH, G5_URL, $filepath.'/'.$thumb);
|
||||
$str = '<img src="'.$file_url.'" width="'.$width.'" height="'.$height.'"';
|
||||
if($id)
|
||||
$str .= ' id="'.$id.'"';
|
||||
$str .= ' alt="">';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
function get_star2($score2)
|
||||
{
|
||||
$star2 = round($score2, 1);
|
||||
if ($star2 < 0) $star2 = 0;
|
||||
return $star2;
|
||||
}
|
||||
|
||||
// 별 카운트
|
||||
function get_star_image2($it_id)
|
||||
{
|
||||
global $g5;
|
||||
|
||||
$sql2 = "select (SUM(is_score) / COUNT(*)) as score from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' and is_confirm = 1 ";
|
||||
$row2 = sql_fetch($sql2);
|
||||
|
||||
return get_star2($row2['score']);
|
||||
}
|
||||
|
||||
// 최신글 함수(메인용)
|
||||
function rb_latest_shop($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='', $md_sca='')
|
||||
{
|
||||
global $g5;
|
||||
|
||||
if (!$skin_dir) $skin_dir = 'basic';
|
||||
|
||||
$time_unit = 3600; // 1시간으로 고정
|
||||
|
||||
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||
if (G5_IS_MOBILE) {
|
||||
$latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||
if(!is_dir($latest_skin_path))
|
||||
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
|
||||
} else {
|
||||
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
|
||||
}
|
||||
$skin_dir = $match[1];
|
||||
} else {
|
||||
if(G5_IS_MOBILE) {
|
||||
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||
} else {
|
||||
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
|
||||
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
|
||||
}
|
||||
}
|
||||
|
||||
$caches = false;
|
||||
|
||||
if(G5_USE_CACHE) {
|
||||
$cache_file_name = "latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}-".g5_cache_secret_key();
|
||||
$caches = g5_get_cache($cache_file_name, (int) $time_unit * (int) $cache_time);
|
||||
$cache_list = isset($caches['list']) ? $caches['list'] : array();
|
||||
g5_latest_cache_data($bo_table, $cache_list);
|
||||
}
|
||||
|
||||
if( $caches === false ){
|
||||
|
||||
$list = array();
|
||||
|
||||
$board = get_board_db($bo_table, true);
|
||||
|
||||
if( ! $board ){
|
||||
return '';
|
||||
}
|
||||
|
||||
$bo_subject = get_text($board['bo_subject']);
|
||||
|
||||
$tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
|
||||
|
||||
if($md_sca) { //카테고리 있는경우
|
||||
$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 and ca_name = '{$md_sca}' order by wr_num limit 0, {$rows} ";
|
||||
} else {
|
||||
$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";
|
||||
}
|
||||
|
||||
|
||||
$result = sql_query($sql);
|
||||
for ($i=0; $row = sql_fetch_array($result); $i++) {
|
||||
try {
|
||||
unset($row['wr_password']); //패스워드 저장 안함( 아예 삭제 )
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$row['wr_email'] = ''; //이메일 저장 안함
|
||||
if (strstr($row['wr_option'], 'secret')){ // 비밀글일 경우 내용, 링크, 파일 저장 안함
|
||||
$row['wr_content'] = $row['wr_link1'] = $row['wr_link2'] = '';
|
||||
$row['file'] = array('count'=>0);
|
||||
}
|
||||
$list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);
|
||||
|
||||
$list[$i]['first_file_thumb'] = (isset($row['wr_file']) && $row['wr_file']) ? get_board_file_db($bo_table, $row['wr_id'], 'bf_file, bf_content', "and bf_type in (1, 2, 3, 18) ", true) : array('bf_file'=>'', 'bf_content'=>'');
|
||||
$list[$i]['bo_table'] = $bo_table;
|
||||
|
||||
|
||||
if(! isset($list[$i]['icon_file'])) $list[$i]['icon_file'] = '';
|
||||
}
|
||||
g5_latest_cache_data($bo_table, $list);
|
||||
|
||||
if(G5_USE_CACHE) {
|
||||
|
||||
$caches = array(
|
||||
'list' => $list,
|
||||
'bo_subject' => sql_escape_string($bo_subject),
|
||||
);
|
||||
|
||||
g5_set_cache($cache_file_name, $caches, (int) $time_unit * (int) $cache_time);
|
||||
}
|
||||
} else {
|
||||
$list = $cache_list;
|
||||
$bo_subject = (is_array($caches) && isset($caches['bo_subject'])) ? $caches['bo_subject'] : '';
|
||||
}
|
||||
|
||||
ob_start();
|
||||
$rb_module_table = "rb_module_shop"; //영카트 메인 모듈
|
||||
include $latest_skin_path.'/latest.skin.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
// 패턴의 내용대로 해당 디렉토리에서 정렬하여 <select> 태그에 적용할 수 있게 반환
|
||||
function rb_list_skin_options($pattern, $dirname='./', $sval='')
|
||||
{
|
||||
$str = '<option value="">출력 스킨을 선택하세요.</option>'.PHP_EOL;
|
||||
|
||||
unset($arr);
|
||||
$handle = opendir($dirname);
|
||||
while ($file = readdir($handle)) {
|
||||
if (preg_match("/$pattern/", $file, $matches)) {
|
||||
$arr[] = $matches[0];
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
sort($arr);
|
||||
foreach($arr as $value) {
|
||||
if($value == $sval)
|
||||
$selected = ' selected="selected"';
|
||||
else
|
||||
$selected = '';
|
||||
|
||||
$str .= '<option value="'.$value.'"'.$selected.'>'.$value.'</option>'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
// 파일이 있는지 검사
|
||||
function rb_list_skin_options_chk($pattern, $dirname = './', $selected_value)
|
||||
{
|
||||
$file_exists = false;
|
||||
$handle = opendir($dirname);
|
||||
while ($file = readdir($handle)) {
|
||||
if (preg_match("/$pattern/", $file) && $file == $selected_value) {
|
||||
$file_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
return $file_exists;
|
||||
}
|
||||
15
extend/rb_youtube.extend.php
Normal file
15
extend/rb_youtube.extend.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
function getYouTubeVideoId($input) {
|
||||
// 입력이 정확히 11자리의 유튜브 동영상 ID 형식인지 확인
|
||||
if (preg_match('/^[a-zA-Z0-9_-]{11}$/', $input)) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
// 유튜브 URL에서 동영상 ID를 추출하는 정규식
|
||||
preg_match('/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:watch\?v=|embed\/|v\/|.+\?v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/', $input, $matches);
|
||||
|
||||
// 매칭된 결과가 있으면 동영상 ID 반환
|
||||
return isset($matches[1]) ? $matches[1] : null;
|
||||
}
|
||||
4
extend/user.config.php
Normal file
4
extend/user.config.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가;
|
||||
if ($member['mb_id'] == 'false9') $is_admin = 'super'; // 테스트용
|
||||
?>
|
||||
Reference in New Issue
Block a user