From 73fa80fc52363fee39e3e9ac03a7f39da8cc3cc9 Mon Sep 17 00:00:00 2001 From: thisgun Date: Tue, 30 Oct 2018 18:08:57 +0900 Subject: [PATCH] =?UTF-8?q?hook=20=EC=BD=94=EB=93=9C=20=EB=B0=8F=20?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=A1=B0=ED=9A=8C=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/board_form_update.php | 2 + adm/member_form_update.php | 2 + adm/member_list_update.php | 8 +- bbs/delete.php | 2 + bbs/delete_all.php | 2 + bbs/delete_comment.php | 2 + bbs/login.php | 2 + bbs/login_check.php | 2 + bbs/logout.php | 2 + bbs/memo_delete.php | 2 + bbs/memo_form_update.php | 17 ++- bbs/move.php | 1 + bbs/move_update.php | 2 + bbs/new_delete.php | 2 + bbs/qawrite_update.php | 2 + bbs/register_form_update.php | 20 +++- bbs/write.php | 2 + bbs/write_comment_update.php | 6 +- bbs/write_update.php | 4 + config.php | 3 +- install/gnuboard5.sql | 4 +- lib/common.lib.php | 22 +++- lib/get_data.lib.php | 103 ++++++++++++++++++ mobile/skin/board/basic/list.skin.php | 8 +- mobile/skin/board/gallery/list.skin.php | 8 +- skin/board/basic/list.skin.php | 8 +- skin/board/gallery/list.skin.php | 8 +- .../mobile/skin/board/basic/list.skin.php | 8 +- .../mobile/skin/board/gallery/list.skin.php | 8 +- theme/basic/skin/board/basic/list.skin.php | 8 +- theme/basic/skin/board/gallery/list.skin.php | 8 +- 31 files changed, 212 insertions(+), 66 deletions(-) diff --git a/adm/board_form_update.php b/adm/board_form_update.php index b3de17f01..1d0114b7f 100644 --- a/adm/board_form_update.php +++ b/adm/board_form_update.php @@ -440,5 +440,7 @@ delete_cache_latest($bo_table); if(function_exists('get_admin_captcha_by')) get_admin_captcha_by('remove'); +start_event('admin_board_form_update', $bo_table, $w); + goto_url("./board_form.php?w=u&bo_table={$bo_table}&{$qstr}"); ?> diff --git a/adm/member_form_update.php b/adm/member_form_update.php index 30dd4e7d5..757a9d1ad 100644 --- a/adm/member_form_update.php +++ b/adm/member_form_update.php @@ -228,5 +228,7 @@ else if ($w == 'u') else alert('제대로 된 값이 넘어오지 않았습니다.'); +start_event('admin_member_form_update', $w, $mb_id); + goto_url('./member_form.php?'.$qstr.'&w=u&mb_id='.$mb_id, false); ?> \ No newline at end of file diff --git a/adm/member_list_update.php b/adm/member_list_update.php index 915fdb880..85b5efc53 100644 --- a/adm/member_list_update.php +++ b/adm/member_list_update.php @@ -12,6 +12,8 @@ auth_check($auth[$sub_menu], 'w'); check_admin_token(); +$mb_datas = array(); + if ($_POST['act_button'] == "선택수정") { for ($i=0; $i alert("'.$msg.'"); '; alert($msg); +start_event('admin_member_list_update', $_POST['act_button'], $mb_datas); + goto_url('./member_list.php?'.$qstr); ?> diff --git a/bbs/delete.php b/bbs/delete.php index eccd079ef..c0a4d1d1c 100644 --- a/bbs/delete.php +++ b/bbs/delete.php @@ -134,5 +134,7 @@ if ($count_write > 0 || $count_comment > 0) delete_cache_latest($bo_table); +start_event('bbs_delete', $write, $board); + goto_url(short_url_clean(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&page='.$page.$qstr)); ?> diff --git a/bbs/delete_all.php b/bbs/delete_all.php index 8bcef3d69..13d4793f8 100644 --- a/bbs/delete_all.php +++ b/bbs/delete_all.php @@ -156,5 +156,7 @@ if ($count_write > 0 || $count_comment > 0) delete_cache_latest($bo_table); +start_event('bbs_delete_all', $tmp_array, $board); + goto_url(short_url_clean(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&page='.$page.$qstr)); ?> diff --git a/bbs/delete_comment.php b/bbs/delete_comment.php index 6b4929f63..c7727398d 100644 --- a/bbs/delete_comment.php +++ b/bbs/delete_comment.php @@ -86,5 +86,7 @@ sql_query(" delete from {$g5['board_new_table']} where bo_table = '{$bo_table}' delete_cache_latest($bo_table); +start_event('bbs_delete_comment', $comment_id, $board); + goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$write['wr_parent'].'&page='.$page. $qstr); ?> diff --git a/bbs/login.php b/bbs/login.php index 30a3fe867..90f593ac1 100644 --- a/bbs/login.php +++ b/bbs/login.php @@ -31,5 +31,7 @@ if (!file_exists($login_file)) include_once($member_skin_path.'/login.skin.php'); +start_event('member_login_tail', $login_url, $login_action_url, $member_skin_path, $url); + include_once('./_tail.sub.php'); ?> diff --git a/bbs/login_check.php b/bbs/login_check.php index ba7c65987..1337657ff 100644 --- a/bbs/login_check.php +++ b/bbs/login_check.php @@ -118,5 +118,7 @@ if(function_exists('social_login_success_after')){ social_login_session_clear(1); } +start_event('member_login_check', $mb, $link); + goto_url($link); ?> diff --git a/bbs/logout.php b/bbs/logout.php index c868e78ee..5925e967b 100644 --- a/bbs/logout.php +++ b/bbs/logout.php @@ -34,5 +34,7 @@ if ($url) { $link = G5_URL; } +start_event('member_logout', $link); + goto_url($link); ?> diff --git a/bbs/memo_delete.php b/bbs/memo_delete.php index 743d8392e..87e3ae853 100644 --- a/bbs/memo_delete.php +++ b/bbs/memo_delete.php @@ -29,5 +29,7 @@ $sql = " delete from {$g5['memo_table']} and (me_recv_mb_id = '{$member['mb_id']}' or me_send_mb_id = '{$member['mb_id']}') "; sql_query($sql); +start_event('memo_delete', $me_id, $row); + goto_url('./memo.php?kind='.$kind); ?> diff --git a/bbs/memo_form_update.php b/bbs/memo_form_update.php index cc9f00abe..2835b9a76 100644 --- a/bbs/memo_form_update.php +++ b/bbs/memo_form_update.php @@ -14,6 +14,9 @@ $str_nick_list = ''; $msg = ''; $error_list = array(); $member_list = array(); + +start_event('memo_form_update_before', $recv_list); + for ($i=0; $i \ No newline at end of file diff --git a/bbs/move.php b/bbs/move.php index c7d435a36..39d5b32c3 100644 --- a/bbs/move.php +++ b/bbs/move.php @@ -156,5 +156,6 @@ function fboardmoveall_submit(f) diff --git a/bbs/move_update.php b/bbs/move_update.php index 198e59dae..f6bcc6af1 100644 --- a/bbs/move_update.php +++ b/bbs/move_update.php @@ -210,6 +210,8 @@ $msg = '해당 게시물을 선택한 게시판으로 '.$act.' 하였습니다.' $opener_href = get_pretty_url($bo_table,'','&page='.$page.'&'.$qstr); $opener_href1 = str_replace('&', '&', $opener_href); +start_event('bbs_move_update', $bo_table, $chk_bo_table, $wr_id_list, $opener_href); + echo << '; +start_event('register_form_update_after', $mb_id, $w); + if ($w == '') { goto_url(G5_HTTP_BBS_URL.'/register_result.php'); } else if ($w == 'u') { diff --git a/bbs/write.php b/bbs/write.php index 7722f3456..ce424d54b 100644 --- a/bbs/write.php +++ b/bbs/write.php @@ -31,6 +31,8 @@ if ($w == 'u' || $w == 'r') { } } +start_event('bbs_write', $board, $wr_id, $w); + if ($w == '') { if ($wr_id) { alert('글쓰기에는 \$wr_id 값을 사용하지 않습니다.', G5_BBS_URL.'/board.php?bo_table='.$bo_table); diff --git a/bbs/write_comment_update.php b/bbs/write_comment_update.php index a1b55501d..224cda5b4 100644 --- a/bbs/write_comment_update.php +++ b/bbs/write_comment_update.php @@ -337,5 +337,9 @@ else if ($w == 'cu') // 댓글 수정 delete_cache_latest($bo_table); -goto_url(short_url_clean(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&'.$qstr.'&#c_'.$comment_id)); +$redirect_url = short_url_clean(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&'.$qstr.'&#c_'.$comment_id); + +start_event('comment_update_after', $board, $wr_id, $w, $qstr, $redirect_url); + +goto_url($redirect_url); ?> diff --git a/bbs/write_update.php b/bbs/write_update.php index b5719fd5b..36d6cdd38 100644 --- a/bbs/write_update.php +++ b/bbs/write_update.php @@ -127,6 +127,8 @@ for ($i=1; $i<=10; $i++) { @include_once($board_skin_path.'/write_update.head.skin.php'); +start_event('write_update_before', $board, $wr_id, $w, $qstr); + if ($w == '' || $w == 'u') { // 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함 @@ -607,6 +609,8 @@ for ($i=0; $i') : '올바른 방법으로 이용해 주십시오.'; @@ -171,6 +173,8 @@ function alert_close($msg, $error=true) { global $g5; + start_event('alert_close', $msg, $error); + $msg = strip_tags($msg, '
'); $header = ''; @@ -247,7 +251,7 @@ function url_auto_link($str) $str = preg_replace("/\t_gt_\t/", ">", $str); */ - return $str; + return apply_replace('url_auto_link', $str); } @@ -3410,6 +3414,20 @@ function check_vaild_callback($callback){ } } +function is_url_base64_encoded($s) +{ + $s_encode = strtr($s, '._-', '+/='); + + if (!preg_match('/^[a-zA-Z0-9\/\r\n+]*={0,2}$/', $s_encode)) return false; + + $decoded = base64_decode($s_encode, true); + if(false === $decoded) return false; + + if(base64_encode($decoded) != $s_encode) return false; + + return true; +} + // 문자열 암복호화 class str_encrypt { @@ -3494,7 +3512,7 @@ function get_member_profile_img($mb_id='', $width='', $height='', $alt='profile_ if( isset($member_cache[$mb_id]) ){ $src = $member_cache[$mb_id]; } else { - $member_img = G5_DATA_PATH.'/member_image/'.substr($mb_id,0,2).'/'.$mb_id.'.gif'; + $member_img = G5_DATA_PATH.'/member_image/'.substr($mb_id,0,2).'/'.get_mb_icon_name($mb_id).'.gif'; if (is_file($member_img)) { $member_cache[$mb_id] = $src = str_replace(G5_DATA_PATH, G5_DATA_URL, $member_img); } diff --git a/lib/get_data.lib.php b/lib/get_data.lib.php index b7f65ad99..5d11c7a51 100644 --- a/lib/get_data.lib.php +++ b/lib/get_data.lib.php @@ -277,6 +277,73 @@ function get_db_create_replace($sql_str){ return $sql_str; } +function get_class_encrypt(){ + static $cache; + + if( $cache && is_object($obj) ){ + return $cache; + } + + $cache = apply_replace('get_class_encrypt', new str_encrypt()); + + return $cache; +} + +function get_string_encrypt($str){ + + $new = get_class_encrypt(); + + $encrypt_str = $new->encrypt($str); + + return $encrypt_str; +} + +function get_bool_encrypt_encoded($str){ + return apply_replace('get_bool_encrypt_encoded', is_url_base64_encoded($str), $str); +} + +function get_string_check_decrypt($str, $field=''){ + + if( $field === 'mb_id' ){ + $pattern = '/[^0-9a-z_]+/i'; + } else { + $pattern = '/[^a-zA-Z0-9\/:@\.\+-s]/'; + } + + if( get_bool_encrypt_encoded($str) ){ + + if( $field === 'mb_id' ){ + return preg_replace($pattern, '', get_string_decrypt($str)); + } + + return get_string_decrypt($str); + } + + return preg_replace($pattern, '', strip_tags($str)); +} + +function get_string_decrypt($str){ + + $new = get_class_encrypt(); + + $decrypt_str = $new->decrypt($str); + + return $decrypt_str; +} + +function get_member_by_hash($mb_id='', $mb_hash=''){ + + global $is_admin; + + if( $is_admin && $mb_id ){ + return $mb_id; + } else if ( $mb_hash ){ + return get_string_check_decrypt($mb_hash, 'mb_id'); + } + + return ''; +} + function get_permission_debug_show(){ global $member; @@ -300,6 +367,15 @@ function get_check_mod_rewrite(){ return $mod_rewrite; } +function get_mb_icon_name($mb_id){ + + if( $icon_name = apply_replace('get_mb_icon_name', '', $mb_id) ){ + return $icon_name; + } + + return md5($mb_id); +} + // 생성되면 안되는 게시판명 function get_bo_table_banned_word(){ @@ -312,6 +388,33 @@ function get_bo_table_banned_word(){ return apply_replace('get_bo_table_banned_word', $folders); } +function get_add_mbhash_params($qstr, $board, $wr_id){ + + if( isset($_GET['mb_hash']) && is_url_base64_encoded($_GET['mb_hash']) ){ + $qstr .= '&mb_hash=' . strip_tags($_GET['mb_hash']); + } + + return $qstr; +} + +function get_board_sfl_select_options($sfl){ + + global $is_admin; + + $str = ''; + $str .= ''; + $str .= ''; + $str .= ''; + if ( $is_admin ){ + $str .= ''; + $str .= ''; + } + $str .= ''; + $str .= ''; + + return apply_replace('get_board_sfl_select_options', $str, $sfl); +} + // 읽지 않은 메모 갯수 반환 function get_memo_not_read($mb_id, $add_where='') { diff --git a/mobile/skin/board/basic/list.skin.php b/mobile/skin/board/basic/list.skin.php index 149d1f22a..c9331c5a2 100644 --- a/mobile/skin/board/basic/list.skin.php +++ b/mobile/skin/board/basic/list.skin.php @@ -136,13 +136,7 @@ add_stylesheet('', 0 diff --git a/mobile/skin/board/gallery/list.skin.php b/mobile/skin/board/gallery/list.skin.php index abaab110a..5d8329eb2 100644 --- a/mobile/skin/board/gallery/list.skin.php +++ b/mobile/skin/board/gallery/list.skin.php @@ -162,13 +162,7 @@ add_stylesheet('', 0 diff --git a/skin/board/basic/list.skin.php b/skin/board/basic/list.skin.php index 7c9fa75d5..8d1ab4dcd 100644 --- a/skin/board/basic/list.skin.php +++ b/skin/board/basic/list.skin.php @@ -165,13 +165,7 @@ add_stylesheet('', 0 diff --git a/skin/board/gallery/list.skin.php b/skin/board/gallery/list.skin.php index 36b32bfbe..e20e146fd 100644 --- a/skin/board/gallery/list.skin.php +++ b/skin/board/gallery/list.skin.php @@ -170,13 +170,7 @@ add_stylesheet('', 0 diff --git a/theme/basic/mobile/skin/board/basic/list.skin.php b/theme/basic/mobile/skin/board/basic/list.skin.php index 149d1f22a..c9331c5a2 100644 --- a/theme/basic/mobile/skin/board/basic/list.skin.php +++ b/theme/basic/mobile/skin/board/basic/list.skin.php @@ -136,13 +136,7 @@ add_stylesheet('', 0 diff --git a/theme/basic/mobile/skin/board/gallery/list.skin.php b/theme/basic/mobile/skin/board/gallery/list.skin.php index 33ad640b1..5f7e18df7 100644 --- a/theme/basic/mobile/skin/board/gallery/list.skin.php +++ b/theme/basic/mobile/skin/board/gallery/list.skin.php @@ -162,13 +162,7 @@ add_stylesheet('', 0 diff --git a/theme/basic/skin/board/basic/list.skin.php b/theme/basic/skin/board/basic/list.skin.php index 7c9fa75d5..8d1ab4dcd 100644 --- a/theme/basic/skin/board/basic/list.skin.php +++ b/theme/basic/skin/board/basic/list.skin.php @@ -165,13 +165,7 @@ add_stylesheet('', 0 diff --git a/theme/basic/skin/board/gallery/list.skin.php b/theme/basic/skin/board/gallery/list.skin.php index 3795ce0c6..05daac605 100644 --- a/theme/basic/skin/board/gallery/list.skin.php +++ b/theme/basic/skin/board/gallery/list.skin.php @@ -170,13 +170,7 @@ add_stylesheet('', 0