From 3706ef99d39c079fef27554f185f0f99a511222a Mon Sep 17 00:00:00 2001 From: kkigomi Date: Sat, 10 Dec 2022 17:06:37 +0900 Subject: [PATCH 1/4] =?UTF-8?q?#212=20PR=EC=97=90=EC=84=9C=20DB=20?= =?UTF-8?q?=EC=BB=A4=EB=84=A5=EC=85=98=20=EC=A7=80=EC=A0=95=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95=20&=20sql=5Fquery=5Fafter=20?= =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=EC=97=90=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EB=90=9C=20$source=20=ED=8C=8C=EB=9D=BC=EB=A9=94=ED=84=B0=20?= =?UTF-8?q?=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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/common.lib.php b/lib/common.lib.php index c1acd17e5..993f804d7 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1648,21 +1648,21 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null) $end_time = ($is_debug || G5_COLLECT_QUERY) ? get_microtime() : 0; $error = null; + $source = array(); if ($is_debug || G5_COLLECT_QUERY) { if(function_exists('mysqli_error') && G5_MYSQLI_USE) { $error = array( - 'error_code' => mysqli_errno($g5['connect_db']), - 'error_message' => mysqli_error($g5['connect_db']), + 'error_code' => mysqli_errno($link), + 'error_message' => mysqli_error($link), ); } else { $error = array( - 'error_code' => mysql_errno($g5['connect_db']), - 'error_message' => mysql_error($g5['connect_db']), + 'error_code' => mysql_errno($link), + 'error_message' => mysql_error($link), ); } $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); - $source = array(); $found = false; foreach ($stack as $index => $trace) { @@ -1706,7 +1706,7 @@ function sql_query($sql, $error=G5_DISPLAY_SQL_ERROR, $link=null) ); } - run_event('sql_query_after', $result, $sql, $start_time, $end_time, $error); + run_event('sql_query_after', $result, $sql, $start_time, $end_time, $error, $source); return $result; } From 4958cc9e35fa047b4a46e6db4a0ceb4c7b6cf35f Mon Sep 17 00:00:00 2001 From: kkigomi Date: Sat, 7 Jan 2023 01:31:05 +0900 Subject: [PATCH 2/4] =?UTF-8?q?goto=5Furl=20=ED=95=A8=EC=88=98=EC=97=90=20?= =?UTF-8?q?Event=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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/common.lib.php b/lib/common.lib.php index 6018674ce..943726dbd 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -96,6 +96,8 @@ function print_r2($var) // header("location:URL") 을 대체 function goto_url($url) { + run_event('goto_url', $url); + $url = str_replace("&", "&", $url); //echo ""; From 3fcc1f2d5f999000549792c5835a2f8d678e317d Mon Sep 17 00:00:00 2001 From: kkigomi Date: Sat, 7 Jan 2023 01:32:14 +0900 Subject: [PATCH 3/4] =?UTF-8?q?html=5Fprocess->run()=EC=97=90=20Replace=20?= =?UTF-8?q?Hook=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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/common.lib.php b/lib/common.lib.php index 6018674ce..ecedd1c34 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -2766,6 +2766,8 @@ class html_process { $buffer = preg_replace('#(]*>.*?)#', "$meta_tag{$nl}$1", $buffer); } + $buffer = run_replace('html_process_buffer', $buffer); + return $buffer; } } From 1891b5eb38c897ae89d80cff86aaa869b9e771c3 Mon Sep 17 00:00:00 2001 From: kkigomi Date: Sat, 7 Jan 2023 01:13:34 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=ED=9A=8C=EC=9B=90=20sideview=20=EB=A9=94?= =?UTF-8?q?=EB=89=B4=EC=97=90=20Replace=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 | 153 ++++++++++++++++++++++++++++++--------------- 1 file changed, 102 insertions(+), 51 deletions(-) diff --git a/lib/common.lib.php b/lib/common.lib.php index 6018674ce..42537406c 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1328,87 +1328,138 @@ function get_sideview($mb_id, $name='', $email='', $homepage='') global $g5; global $bo_table, $sca, $is_admin, $member; - $email = get_string_encrypt($email); - $homepage = set_http(clean_xss_tags($homepage)); + static $cache = array(); - $name = get_text($name, 0, true); - $email = get_text($email); + $name = get_text($name, 0, true); + + if (isset($cache['id:' . $mb_id]) && $cache['id:' . $mb_id]) { + return $cache['id:' . $mb_id]; + } else if ( + isset($name) + && isset($cache['name:' . $name]) + && $cache['name:' . $name] + ) { + return $cache['name:' . $name]; + } + + $email = get_string_encrypt($email); + $email = get_text($email); + + $homepage = set_http(clean_xss_tags($homepage)); $homepage = get_text($homepage); - $tmp_name = ""; $en_mb_id = $mb_id; + $name_tag = array(); + $menus = array(); + if ($mb_id) { - //$tmp_name = "$name"; - $tmp_name = ''; + // $tmp_name = "$name"; + $name_tag_open = ''; if ($config['cf_use_member_icon']) { - $mb_dir = substr($mb_id,0,2); - $icon_file = G5_DATA_PATH.'/member/'.$mb_dir.'/'.get_mb_icon_name($mb_id).'.gif'; + $mb_dir = substr($mb_id, 0, 2); + $icon_file = G5_DATA_PATH . '/member/' . $mb_dir . '/' . get_mb_icon_name($mb_id) . '.gif'; if (file_exists($icon_file)) { - $icon_filemtile = (defined('G5_USE_MEMBER_IMAGE_FILETIME') && G5_USE_MEMBER_IMAGE_FILETIME) ? '?'.filemtime($icon_file) : ''; + $icon_filemtile = (defined('G5_USE_MEMBER_IMAGE_FILETIME') && G5_USE_MEMBER_IMAGE_FILETIME) ? '?' . filemtime($icon_file) : ''; $width = $config['cf_member_icon_width']; $height = $config['cf_member_icon_height']; - $icon_file_url = G5_DATA_URL.'/member/'.$mb_dir.'/'.get_mb_icon_name($mb_id).'.gif'.$icon_filemtile; - $tmp_name .= ''; + $icon_file_url = G5_DATA_URL . '/member/' . $mb_dir . '/' . get_mb_icon_name($mb_id) . '.gif' . $icon_filemtile; + $name_tag['profile_image'] = ''; - if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름 - $tmp_name = $tmp_name.' '.$name; + // 회원아이콘+이름 + if ($config['cf_use_member_icon'] == 2) { + $name_tag['name'] = $name; + } } else { - if( defined('G5_THEME_NO_PROFILE_IMG') ){ - $tmp_name .= G5_THEME_NO_PROFILE_IMG; - } else if( defined('G5_NO_PROFILE_IMG') ){ - $tmp_name .= G5_NO_PROFILE_IMG; + if (defined('G5_THEME_NO_PROFILE_IMG')) { + $name_tag['profile_image'] = G5_THEME_NO_PROFILE_IMG; + } else if (defined('G5_NO_PROFILE_IMG')) { + $name_tag['profile_image'] = G5_NO_PROFILE_IMG; + } + + // 회원아이콘+이름 + if ($config['cf_use_member_icon'] == 2) { + $name_tag['name'] = $name; } - if ($config['cf_use_member_icon'] == 2) // 회원아이콘+이름 - $tmp_name = $tmp_name.' '.$name; } } else { - $tmp_name = $tmp_name.' '.$name; + $name_tag['name'] = $name; } - $tmp_name .= ''; - - $title_mb_id = '['.$mb_id.']'; } else { - if(!$bo_table) + if (!$bo_table) { return $name; + } - $tmp_name = ''.$name.''; - $title_mb_id = '[비회원]'; + $name_tag_open = ''; + $name_tag['name'] = $name; } - $str = "\n"; - $str .= $tmp_name."\n"; + if ($mb_id) { + $menus['memo'] = '쪽지보내기'; + } - $str2 = "\n"; - if($mb_id) - $str2 .= "쪽지보내기\n"; - if($email) - $str2 .= "메일보내기\n"; - if($homepage) - $str2 .= "홈페이지\n"; - if($mb_id) - $str2 .= "자기소개\n"; - if($bo_table) { - if($mb_id) { - $str2 .= "아이디로 검색\n"; + if ($email) { + $menus['email'] = '메일보내기'; + } + + if ($homepage) { + $menus['homepage'] = '홈페이지'; + } + + if ($mb_id) { + $menus['profile'] = '자기소개'; + } + + if ($bo_table) { + if ($mb_id) { + $menus['search_id'] = '아이디로 검색'; } else { - $str2 .= "이름으로 검색\n"; + $menus['search_name'] = '이름으로 검색'; } } - if($mb_id) - $str2 .= "전체게시물\n"; - if($is_admin == "super" && $mb_id) { - $str2 .= "회원정보변경\n"; - $str2 .= "포인트내역\n"; - } - $str2 .= "\n"; - $str .= $str2; - $str .= "\n"; + if ($mb_id) { + $menus['search_all'] = '전체게시물'; + + if ($is_admin == 'super') { + $menus['admin_member_modify'] = '회원정보변경'; + $menus['admin_member_point'] = '포인트내역'; + } + } + + $name_tag_close = ''; + + $items = run_replace('member_sideview_items', array( + 'name_tag_open' => $name_tag_open, + 'name_tag_close' => $name_tag_close, + 'name_tag' => $name_tag, + 'menus' => $menus + ), array( + 'mb_id' => $mb_id, + 'name' => $name, + 'bo_table' => $bo_table, + ) + ); + + $str = ''; + $str .= $items['name_tag_open'] . implode(' ', $items['name_tag']) . $items['name_tag_close']; + + $str2 = ''; + $str2 .= implode("\n", $items['menus']); + $str2 .= ''; + + $str .= $str2; + $str .= ''; $str .= ""; + if ($mb_id) { + $cache['id:' . $mb_id] = $str; + } else { + $cache['name:' . $name] = $str; + } + return $str; }