Skip to content

Commit

Permalink
5.4 버전 hook 이벤트 추가 및 hook 추적에 Object도 가능하게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Oct 19, 2020
1 parent df9891e commit 94d0481
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 13 deletions.
2 changes: 2 additions & 0 deletions adm/boardgroup_form_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,7 @@
alert('제대로 된 값이 넘어오지 않았습니다.');
}

run_event('admin_boardgroup_form_update', $gr_id, $w);

goto_url('./boardgroup_form.php?w=u&gr_id='.$gr_id.'&'.$qstr);
?>
18 changes: 12 additions & 6 deletions adm/boardgroup_list_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,23 @@

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])."',
Expand All @@ -33,7 +37,7 @@
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&amp;stx='.$gr_id);
Expand All @@ -46,5 +50,7 @@
}
}

run_event('admin_boardgroup_list_update', $act_button, $chk, $post_group_id, $qstr);

goto_url('./boardgroup_list.php?'.$qstr);
?>
2 changes: 2 additions & 0 deletions adm/menu_list_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@
sql_query($sql);
}

run_event('admin_menu_list_update');

goto_url('./menu_list.php');
?>
6 changes: 3 additions & 3 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function sql_escape_string($str)
//------------------------------------------------------------------------------
// 기본환경설정
// 기본적으로 사용하는 필드만 얻은 후 상황에 따라 필드를 추가로 얻음
$config = get_config();
$config = get_config(true);

// 본인인증 또는 쇼핑몰 사용시에만 secure; SameSite=None 로 설정합니다.
if( $config['cf_cert_use'] || (defined('G5_YOUNGCART_VER') && G5_YOUNGCART_VER) ) {
Expand Down Expand Up @@ -442,7 +442,7 @@ function session_start_samesite($options = array())
$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'];
Expand All @@ -465,7 +465,7 @@ function session_start_samesite($options = array())
}

if ($gr_id && !is_array($gr_id)) {
$group = get_group($gr_id);
$group = get_group($gr_id, true);
}

if ($config['cf_editor']) {
Expand Down
1 change: 1 addition & 0 deletions lib/common.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]) ){
Expand Down
3 changes: 1 addition & 2 deletions lib/get_data.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
38 changes: 36 additions & 2 deletions plugin/debugbar/debugbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,30 @@
$is_print = $rowspan;

foreach($datas as $data){

$print_function = '';

if( $data['function'] && is_array($data['function']) ){
foreach( (array) $data['function'] as $key=>$fn_name ){
$str_delimiter = '';
if($key) $str_delimiter = ' :: ';

if( is_object($fn_name) ){
$fn_name = get_class($fn_name);
}

$print_function .= $str_delimiter.(string) $fn_name;
}
} else {
$print_function = $data['function'];
}
?>
<tr>
<?php if ($is_print){ ?>
<td scope="row" data-label="event_tag" <?php echo $rowspan; ?>><?php echo $tag.' <span class="hook_count">('.$count.')</span>'; ?></td>
<?php } ?>
<td data-label="event_function">
<?php echo $data['function']; ?>
<?php echo $print_function; ?>
</td>
<td data-label="인수의 수"><?php echo $data['arguments']; ?></td>
<td data-label="우선 순위"><?php echo $data['priority']; ?></td>
Expand Down Expand Up @@ -194,13 +211,30 @@
$is_print = $rowspan;

foreach($datas as $data){

$print_function = '';

if( $data['function'] && is_array($data['function']) ){
foreach( (array) $data['function'] as $key=>$fn_name ){
$str_delimiter = '';
if($key) $str_delimiter = ' :: ';

if( is_object($fn_name) ){
$fn_name = get_class($fn_name);
}

$print_function .= $str_delimiter.(string) $fn_name;
}
} else {
$print_function = $data['function'];
}
?>
<tr>
<?php if ($is_print){ ?>
<td scope="row" data-label="replace_tag" <?php echo $rowspan; ?>><?php echo $tag.' <span class="hook_count">('.$count.')</span>'; ?></td>
<?php } ?>
<td data-label="replace_function">
<?php echo $data['function']; ?>
<?php echo $print_function; ?>
</td>
<td data-label="인수의 수"><?php echo $data['arguments']; ?></td>
<td data-label="우선 순위"><?php echo $data['priority']; ?></td>
Expand Down

0 comments on commit 94d0481

Please sign in to comment.