From 94d04817c79af057235088c45f8f63d47830fd7f Mon Sep 17 00:00:00 2001 From: thisgun Date: Mon, 19 Oct 2020 18:21:17 +0900 Subject: [PATCH 1/9] =?UTF-8?q?5.4=20=EB=B2=84=EC=A0=84=20hook=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20hook=20?= =?UTF-8?q?=EC=B6=94=EC=A0=81=EC=97=90=20Object=EB=8F=84=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=98=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/boardgroup_form_update.php | 2 ++ adm/boardgroup_list_update.php | 18 ++++++++++------ adm/menu_list_update.php | 2 ++ common.php | 6 +++--- lib/common.lib.php | 1 + lib/get_data.lib.php | 3 +-- plugin/debugbar/debugbar.php | 38 ++++++++++++++++++++++++++++++++-- 7 files changed, 57 insertions(+), 13 deletions(-) diff --git a/adm/boardgroup_form_update.php b/adm/boardgroup_form_update.php index b7e5cb4f2..35d8843c1 100644 --- a/adm/boardgroup_form_update.php +++ b/adm/boardgroup_form_update.php @@ -69,5 +69,7 @@ if ($w == '') { alert('제대로 된 값이 넘어오지 않았습니다.'); } +run_event('admin_boardgroup_form_update', $gr_id, $w); + goto_url('./boardgroup_form.php?w=u&gr_id='.$gr_id.'&'.$qstr); ?> diff --git a/adm/boardgroup_list_update.php b/adm/boardgroup_list_update.php index ee8971c2d..b49a673b9 100644 --- a/adm/boardgroup_list_update.php +++ b/adm/boardgroup_list_update.php @@ -10,19 +10,23 @@ auth_check($auth[$sub_menu], 'w'); check_admin_token(); -$count = count($_POST['chk']); +$post_chk = isset($_POST['chk']) ? (array) $_POST['chk'] : array(); +$post_group_id = isset($_POST['group_id']) ? (array) $_POST['group_id'] : array(); +$act_button = isset($_POST['act_button']) ? $_POST['act_button'] : ''; + +$count = count($post_chk); if(!$count) - alert($_POST['act_button'].'할 게시판그룹을 1개이상 선택해 주세요.'); + alert($act_button.'할 게시판그룹을 1개이상 선택해 주세요.'); for ($i=0; $i<$count; $i++) { - $k = $_POST['chk'][$i]; - $gr_id = preg_replace('/[^a-z0-9_]/i', '', $_POST['group_id'][$k]); + $k = $post_chk[$i]; + $gr_id = preg_replace('/[^a-z0-9_]/i', '', $post_group_id[$k]); $gr_subject = is_array($_POST['gr_subject']) ? strip_tags(clean_xss_attributes($_POST['gr_subject'][$k])) : ''; $gr_admin = is_array($_POST['gr_admin']) ? strip_tags(clean_xss_attributes($_POST['gr_admin'][$k])) : ''; - if($_POST['act_button'] == '선택수정') { + if($act_button == '선택수정') { $sql = " update {$g5['group_table']} set gr_subject = '{$gr_subject}', gr_device = '".sql_real_escape_string($_POST['gr_device'][$k])."', @@ -33,7 +37,7 @@ for ($i=0; $i<$count; $i++) if ($is_admin != 'super') $sql .= " and gr_admin = '{$gr_admin}' "; sql_query($sql); - } else if($_POST['act_button'] == '선택삭제') { + } else if($act_button == '선택삭제') { $row = sql_fetch(" select count(*) as cnt from {$g5['board_table']} where gr_id = '$gr_id' "); if ($row['cnt']) alert("이 그룹에 속한 게시판이 존재하여 게시판 그룹을 삭제할 수 없습니다.\\n\\n이 그룹에 속한 게시판을 먼저 삭제하여 주십시오.", './board_list.php?sfl=gr_id&stx='.$gr_id); @@ -46,5 +50,7 @@ for ($i=0; $i<$count; $i++) } } +run_event('admin_boardgroup_list_update', $act_button, $chk, $post_group_id, $qstr); + goto_url('./boardgroup_list.php?'.$qstr); ?> diff --git a/adm/menu_list_update.php b/adm/menu_list_update.php index 160c578a7..528a5a42b 100644 --- a/adm/menu_list_update.php +++ b/adm/menu_list_update.php @@ -68,5 +68,7 @@ for ($i=0; $i<$count; $i++) sql_query($sql); } +run_event('admin_menu_list_update'); + goto_url('./menu_list.php'); ?> diff --git a/common.php b/common.php index 4423de19b..8100e85ca 100644 --- a/common.php +++ b/common.php @@ -221,7 +221,7 @@ ini_set("session.cookie_domain", G5_COOKIE_DOMAIN); //------------------------------------------------------------------------------ // 기본환경설정 // 기본적으로 사용하는 필드만 얻은 후 상황에 따라 필드를 추가로 얻음 -$config = get_config(); +$config = get_config(true); // 본인인증 또는 쇼핑몰 사용시에만 secure; SameSite=None 로 설정합니다. if( $config['cf_cert_use'] || (defined('G5_YOUNGCART_VER') && G5_YOUNGCART_VER) ) { @@ -442,7 +442,7 @@ if ($_SESSION['ss_mb_id']) { // 로그인중이라면 $write = array(); $write_table = ""; if ($bo_table) { - $board = get_board_db($bo_table); + $board = get_board_db($bo_table, true); if ($board['bo_table']) { set_cookie("ck_bo_table", $board['bo_table'], 86400 * 1); $gr_id = $board['gr_id']; @@ -465,7 +465,7 @@ if ($bo_table) { } if ($gr_id && !is_array($gr_id)) { - $group = get_group($gr_id); + $group = get_group($gr_id, true); } if ($config['cf_editor']) { diff --git a/lib/common.lib.php b/lib/common.lib.php index 5ea5bfa80..d0fca65d1 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -754,6 +754,7 @@ function get_group($gr_id, $is_cache=false) static $cache = array(); $gr_id = preg_replace('/[^a-z0-9_]/i', '', $gr_id); + $cache = run_replace('get_group_db_cache', $cache, $gr_id, $is_cache); $key = md5($gr_id); if( $is_cache && isset($cache[$key]) ){ diff --git a/lib/get_data.lib.php b/lib/get_data.lib.php index cfa53a81f..430b69d06 100644 --- a/lib/get_data.lib.php +++ b/lib/get_data.lib.php @@ -70,11 +70,10 @@ function get_board_db($bo_table, $is_cache=false){ static $cache = array(); + $bo_table = preg_replace('/[^a-z0-9_]/i', '', $bo_table); $cache = run_replace('get_board_db_cache', $cache, $bo_table, $is_cache); - $key = md5($bo_table); - $bo_table = preg_replace('/[^a-z0-9_]/i', '', $bo_table); if( $is_cache && isset($cache[$key]) ){ return $cache[$key]; } diff --git a/plugin/debugbar/debugbar.php b/plugin/debugbar/debugbar.php index f93cf3be5..fce0c8aad 100644 --- a/plugin/debugbar/debugbar.php +++ b/plugin/debugbar/debugbar.php @@ -118,13 +118,30 @@ add_stylesheet('>('.$count.')'; ?> - + @@ -194,13 +211,30 @@ add_stylesheet('>('.$count.')'; ?> - + From bf13cf82eeee99410b565790eb05fdf4593e12e4 Mon Sep 17 00:00:00 2001 From: thisgun Date: Wed, 18 Mar 2020 11:55:32 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=EC=B5=9C=EC=8B=A0=EA=B8=80=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=20=EC=83=9D=EC=84=B1=20=EC=A3=BC=EA=B8=B0=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Cache/FileCache.class.php | 19 +++++++++++++------ lib/cache.lib.php | 4 ++-- lib/latest.lib.php | 6 ++++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lib/Cache/FileCache.class.php b/lib/Cache/FileCache.class.php index 529312a5f..e220f6282 100644 --- a/lib/Cache/FileCache.class.php +++ b/lib/Cache/FileCache.class.php @@ -33,9 +33,9 @@ class FileCache * * @param string $id */ - public function get($id) + public function get($id, $expired_time=0) { - $data = $this->_get($id); + $data = $this->_get($id, $expired_time); return is_array($data) ? $data['data'] : FALSE; } @@ -59,7 +59,7 @@ class FileCache } - protected function _get($id) + protected function _get($id, $expired_time=0) { $cache_file_path = $this->get_cache_file_path($id); @@ -68,20 +68,27 @@ class FileCache return FALSE; } + $server_time = defined('G5_SERVER_TIME') ? G5_SERVER_TIME : time(); + try{ $file_contents = file_get_contents($cache_file_path); $file_ex = explode("\n\n", $file_contents); $data = unserialize(base64_decode($file_ex[1])); } catch(Exception $e){ - $data = array('ttl'=>1, 'time'=>time() - 1000); + $data = array('ttl'=>1, 'time'=> $server_time - 1000); } - - if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) + + if ($data['ttl'] > 0 && $server_time > $data['time'] + $data['ttl']) { unlink( $cache_file_path ); return FALSE; } + if ($data['time'] && $expired_time && $data['time'] < ($server_time - $expired_time)){ + unlink( $cache_file_path ); + return FALSE; + } + return $data; } diff --git a/lib/cache.lib.php b/lib/cache.lib.php index b2806d6f7..07b640148 100644 --- a/lib/cache.lib.php +++ b/lib/cache.lib.php @@ -52,10 +52,10 @@ function g5_set_cache($key, $save_data, $ttl = null){ } } -function g5_get_cache($key){ +function g5_get_cache($key, $expired_time=0){ if( $cache = get_cachemanage_instance() ){ - return $cache->get($key); + return $cache->get($key, $expired_time); } return false; diff --git a/lib/latest.lib.php b/lib/latest.lib.php index f374ae899..4d60a0b0a 100644 --- a/lib/latest.lib.php +++ b/lib/latest.lib.php @@ -9,6 +9,8 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time= global $g5; if (!$skin_dir) $skin_dir = 'basic'; + + $time_unit = 3600; // 1시간으로 고정 if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) { if (G5_IS_MOBILE) { @@ -35,7 +37,7 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time= 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); + $caches = g5_get_cache($cache_file_name, $time_unit * $cache_time); $cache_list = isset($caches['list']) ? $caches['list'] : array(); g5_latest_cache_data($bo_table, $cache_list); } @@ -90,7 +92,7 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time= 'bo_subject' => sql_escape_string($bo_subject), ); - g5_set_cache($cache_file_name, $caches, 3600 * $cache_time); + g5_set_cache($cache_file_name, $caches, $time_unit * $cache_time); } } else { $list = $cache_list; From 0e2cb366e62958c7015c66c4c83b8d37f9a90b45 Mon Sep 17 00:00:00 2001 From: thisgun Date: Tue, 20 Oct 2020 19:06:08 +0900 Subject: [PATCH 3/9] =?UTF-8?q?5.4=20=EB=B2=84=EC=A0=84=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20hook=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/common.lib.php b/lib/common.lib.php index d0fca65d1..ad1648eaa 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1606,15 +1606,19 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null) } } + $end_time = $is_debug ? get_microtime() : 0; + if($result && $is_debug) { // 여기에 실행한 sql문을 화면에 표시하는 로직 넣기 $g5_debug['sql'][] = array( 'sql' => $sql, 'start_time' => $start_time, - 'end_time' => get_microtime(), + 'end_time' => $end_time, ); } + run_event('sql_query_after', $result, $sql, $start_time, $end_time); + return $result; } From d015f63301433dd291b0950fc39bb8eb2fc679f2 Mon Sep 17 00:00:00 2001 From: thisgun Date: Thu, 22 Oct 2020 14:59:30 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=EC=B9=B4=EC=B9=B4=EC=98=A4=20REST=20API?= =?UTF-8?q?=ED=82=A4=20=EC=8B=A0=EC=B2=AD=20URL=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=86=8C=EC=85=9C=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80css=20=EC=A3=BC=EC=86=8C=EC=97=90=20?= =?UTF-8?q?querystring=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/config_form.php | 2 +- mobile/skin/social/social_login.skin.php | 2 +- mobile/skin/social/social_outlogin.skin.1.php | 2 +- mobile/skin/social/social_register.skin.php | 2 +- mobile/skin/social/social_register_member.skin.php | 2 +- mobile/skin/social/social_u_register_form.skin.php | 2 +- skin/social/social_login.skin.php | 2 +- skin/social/social_outlogin.skin.1.php | 2 +- skin/social/social_register.skin.php | 2 +- skin/social/social_register_member.skin.php | 2 +- skin/social/social_u_register_form.skin.php | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/adm/config_form.php b/adm/config_form.php index 016355d11..4a8bdd8e9 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -1183,7 +1183,7 @@ include_once('_rewrite_config_form.php'); - 앱 등록하기 + 앱 등록하기 diff --git a/mobile/skin/social/social_login.skin.php b/mobile/skin/social/social_login.skin.php index e7af20ad9..0e2871875 100644 --- a/mobile/skin/social/social_login.skin.php +++ b/mobile/skin/social/social_login.skin.php @@ -14,7 +14,7 @@ if( G5_SOCIAL_USE_POPUP ) { $self_url = G5_SOCIAL_LOGIN_URL.'/popup.php'; } -add_stylesheet('', 10); +add_stylesheet('', 10); ?>