Checked PSR-1: Basic Coding Standard & Undefined Variable
This commit is contained in:
@ -2,25 +2,34 @@
|
||||
$sub_menu = "300100";
|
||||
include_once('./_common.php');
|
||||
|
||||
if ($w == 'u')
|
||||
if ($w == 'u') {
|
||||
check_demo();
|
||||
}
|
||||
|
||||
auth_check_menu($auth, $sub_menu, 'w');
|
||||
|
||||
check_admin_token();
|
||||
|
||||
$gr_id = isset($_POST['gr_id']) ? preg_replace('/[^a-z0-9_]/i', '', $_POST['gr_id']) : '';
|
||||
$bo_admin = isset($_POST['bo_admin']) ? preg_replace('/[^a-z0-9_\, \|\#]/i', '', $_POST['bo_admin']) : '';
|
||||
$bo_subject = isset($_POST['bo_subject']) ? strip_tags(clean_xss_attributes($_POST['bo_subject'])) : '';
|
||||
$bo_mobile_subject = isset($_POST['bo_mobile_subject']) ? strip_tags(clean_xss_attributes($_POST['bo_mobile_subject'])) : '';
|
||||
$gr_id = isset($_POST['gr_id']) ? preg_replace('/[^a-z0-9_]/i', '', (string)$_POST['gr_id']) : '';
|
||||
$bo_admin = isset($_POST['bo_admin']) ? preg_replace('/[^a-z0-9_\, \|\#]/i', '', $_POST['bo_admin']) : '';
|
||||
$bo_subject = isset($_POST['bo_subject']) ? strip_tags(clean_xss_attributes($_POST['bo_subject'])) : '';
|
||||
$bo_mobile_subject = isset($_POST['bo_mobile_subject']) ? strip_tags(clean_xss_attributes($_POST['bo_mobile_subject'])) : '';
|
||||
|
||||
if (!$gr_id) { alert('그룹 ID는 반드시 선택하세요.'); }
|
||||
if (!$bo_table) { alert('게시판 TABLE명은 반드시 입력하세요.'); }
|
||||
if (!preg_match("/^([A-Za-z0-9_]{1,20})$/", $bo_table)) { alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); }
|
||||
if (!$bo_subject) { alert('게시판 제목을 입력하세요.'); }
|
||||
if (!$gr_id) {
|
||||
alert('그룹 ID는 반드시 선택하세요.');
|
||||
}
|
||||
if (!$bo_table) {
|
||||
alert('게시판 TABLE명은 반드시 입력하세요.');
|
||||
}
|
||||
if (!preg_match("/^([A-Za-z0-9_]{1,20})$/", $bo_table)) {
|
||||
alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)');
|
||||
}
|
||||
if (!$bo_subject) {
|
||||
alert('게시판 제목을 입력하세요.');
|
||||
}
|
||||
|
||||
// 게시판명이 금지된 단어로 되어 있으면
|
||||
if ( $w == '' && in_array($bo_table, get_bo_table_banned_word()) ){
|
||||
if ($w == '' && in_array($bo_table, get_bo_table_banned_word())) {
|
||||
alert('입력한 게시판 TABLE명을 사용할수 없습니다. 다른 이름으로 입력해 주세요.');
|
||||
}
|
||||
|
||||
@ -28,7 +37,7 @@ $bo_include_head = isset($_POST['bo_include_head']) ? preg_replace(array("#[\\\]
|
||||
$bo_include_tail = isset($_POST['bo_include_tail']) ? preg_replace(array("#[\\\]+$#", "#(<\?php|<\?)#i"), "", substr($_POST['bo_include_tail'], 0, 255)) : '';
|
||||
|
||||
// 관리자가 자동등록방지를 사용해야 할 경우
|
||||
if ($board && (isset($board['bo_include_head']) && $board['bo_include_head'] !== $bo_include_head || $board['bo_include_tail'] !== $bo_include_tail) && function_exists('get_admin_captcha_by') && get_admin_captcha_by()){
|
||||
if ($board && (isset($board['bo_include_head']) && $board['bo_include_head'] !== $bo_include_head || $board['bo_include_tail'] !== $bo_include_tail) && function_exists('get_admin_captcha_by') && get_admin_captcha_by()) {
|
||||
include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');
|
||||
|
||||
if (!chk_captcha()) {
|
||||
@ -39,7 +48,7 @@ if ($board && (isset($board['bo_include_head']) && $board['bo_include_head'] !==
|
||||
if ($file = $bo_include_head) {
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file) ) {
|
||||
if (! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file)) {
|
||||
alert('상단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
|
||||
}
|
||||
}
|
||||
@ -47,20 +56,20 @@ if ($file = $bo_include_head) {
|
||||
if ($file = $bo_include_tail) {
|
||||
$file_ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
|
||||
if( ! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file) ) {
|
||||
if (! $file_ext || ! in_array($file_ext, array('php', 'htm', 'html')) || ! preg_match('/^.*\.(php|htm|html)$/i', $file)) {
|
||||
alert('하단 파일 경로의 확장자는 php, htm, html 만 허용합니다.');
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_include_path_check($bo_include_head, 1)) {
|
||||
if (!is_include_path_check($bo_include_head, 1)) {
|
||||
alert('상단 파일 경로에 포함시킬수 없는 문자열이 있습니다.');
|
||||
}
|
||||
|
||||
if(!is_include_path_check($bo_include_tail, 1)) {
|
||||
if (!is_include_path_check($bo_include_tail, 1)) {
|
||||
alert('하단 파일 경로에 포함시킬수 없는 문자열이 있습니다.');
|
||||
}
|
||||
|
||||
if( function_exists('filter_input_include_path') ){
|
||||
if (function_exists('filter_input_include_path')) {
|
||||
$bo_include_head = filter_input_include_path($bo_include_head);
|
||||
$bo_include_tail = filter_input_include_path($bo_include_tail);
|
||||
}
|
||||
@ -73,7 +82,7 @@ $board_path = G5_DATA_PATH.'/file/'.$bo_table;
|
||||
|
||||
// 디렉토리에 있는 파일의 목록을 보이지 않게 한다.
|
||||
$file = $board_path . '/index.php';
|
||||
if( $f = @fopen($file, 'w') ){
|
||||
if ($f = @fopen($file, 'w')) {
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, G5_FILE_PERMISSION);
|
||||
@ -84,7 +93,7 @@ $src_char = array('&', '=');
|
||||
$dst_char = array('&', '〓');
|
||||
$bo_category_list = isset($_POST['bo_category_list']) ? str_replace($src_char, $dst_char, $_POST['bo_category_list']) : '';
|
||||
//https://github.com/gnuboard/gnuboard5/commit/f5f4925d4eb28ba1af728e1065fc2bdd9ce1da58 에 따른 조치
|
||||
$str_bo_category_list = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", "", $bo_category_list);
|
||||
$str_bo_category_list = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", "", (string)$bo_category_list);
|
||||
|
||||
$bo_use_category = isset($_POST['bo_use_category']) ? (int) $_POST['bo_use_category'] : 0;
|
||||
$bo_use_sideview = isset($_POST['bo_use_sideview']) ? (int) $_POST['bo_use_sideview'] : 0;
|
||||
@ -154,7 +163,7 @@ $bo_sort_field = isset($_POST['bo_sort_field']) ? clean_xss_tags($_POST['bo_sort
|
||||
|
||||
$etcs = array();
|
||||
|
||||
for($i=1;$i<=10;$i++){
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
$etcs['bo_'.$i.'_subj'] = ${'bo_'.$i.'_subj'} = isset($_POST['bo_'.$i.'_subj']) ? $_POST['bo_'.$i.'_subj'] : '';
|
||||
$etcs['bo_'.$i] = ${'bo_'.$i} = isset($_POST['bo_'.$i]) ? $_POST['bo_'.$i] : '';
|
||||
}
|
||||
@ -212,8 +221,8 @@ $sql_common = " gr_id = '{$gr_id}',
|
||||
";
|
||||
|
||||
// 최고 관리자인 경우에만 수정가능
|
||||
if ($is_admin === 'super'){
|
||||
$sql_common .= " bo_include_head = '".$bo_include_head."',
|
||||
if ($is_admin === 'super') {
|
||||
$sql_common .= " bo_include_head = '".$bo_include_head."',
|
||||
bo_include_tail = '".$bo_include_tail."',
|
||||
bo_content_head = '{$bo_content_head}',
|
||||
bo_content_tail = '{$bo_content_tail}',
|
||||
@ -260,10 +269,10 @@ $sql_common .= " bo_insert_content = '{$bo_insert_content}',
|
||||
bo_10 = '{$bo_10}' ";
|
||||
|
||||
if ($w == '') {
|
||||
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['board_table']} where bo_table = '{$bo_table}' ");
|
||||
if ($row['cnt'])
|
||||
if ($row['cnt']) {
|
||||
alert($bo_table.' 은(는) 이미 존재하는 TABLE 입니다.');
|
||||
}
|
||||
|
||||
$sql = " insert into {$g5['board_table']}
|
||||
set bo_table = '{$bo_table}',
|
||||
@ -284,10 +293,8 @@ if ($w == '') {
|
||||
$source = array('/__TABLE_NAME__/', '/;/');
|
||||
$target = array($create_table, '');
|
||||
$sql = preg_replace($source, $target, $sql);
|
||||
sql_query($sql, FALSE);
|
||||
|
||||
} else if ($w == 'u') {
|
||||
|
||||
sql_query($sql, false);
|
||||
} elseif ($w == 'u') {
|
||||
// 게시판의 글 수
|
||||
$sql = " select count(*) as cnt from {$g5['write_prefix']}{$bo_table} where wr_is_comment = 0 ";
|
||||
$row = sql_fetch($sql);
|
||||
@ -327,8 +334,7 @@ if ($w == '') {
|
||||
for ($i=0; $i<count($tmp_array); $i++) {
|
||||
$tmp_wr_id = trim($tmp_array[$i]);
|
||||
$row = sql_fetch(" select count(*) as cnt from {$g5['write_prefix']}{$bo_table} where wr_id = '{$tmp_wr_id}' ");
|
||||
if ($row['cnt'])
|
||||
{
|
||||
if ($row['cnt']) {
|
||||
$bo_notice .= $lf . $tmp_wr_id;
|
||||
$lf = ",";
|
||||
}
|
||||
@ -342,7 +348,6 @@ if ($w == '') {
|
||||
{$sql_common}
|
||||
where bo_table = '{$bo_table}' ";
|
||||
sql_query($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -412,7 +417,7 @@ if (is_checked('chk_grp_upload_count')) $grp_fields .= " , bo_upload_cou
|
||||
if (is_checked('chk_grp_upload_size')) $grp_fields .= " , bo_upload_size = '{$bo_upload_size}' ";
|
||||
|
||||
//최고관리자만 수정가능
|
||||
if ($is_admin === 'super'){
|
||||
if ($is_admin === 'super') {
|
||||
if (is_checked('chk_grp_include_head')) $grp_fields .= " , bo_include_head = '{$bo_include_head}' ";
|
||||
if (is_checked('chk_grp_include_tail')) $grp_fields .= " , bo_include_tail = '{$bo_include_tail}' ";
|
||||
if (is_checked('chk_grp_content_head')) $grp_fields .= " , bo_content_head = '{$bo_content_head}' ";
|
||||
@ -502,7 +507,7 @@ if (is_checked('chk_all_upload_count')) $all_fields .= " , bo_upload_cou
|
||||
if (is_checked('chk_all_upload_size')) $all_fields .= " , bo_upload_size = '{$bo_upload_size}' ";
|
||||
|
||||
//최고관리자만 수정가능
|
||||
if ($is_admin === 'super'){
|
||||
if ($is_admin === 'super') {
|
||||
if (is_checked('chk_all_include_head')) $all_fields .= " , bo_include_head = '{$bo_include_head}' ";
|
||||
if (is_checked('chk_all_include_tail')) $all_fields .= " , bo_include_tail = '{$bo_include_tail}' ";
|
||||
if (is_checked('chk_all_content_head')) $all_fields .= " , bo_content_head = '{$bo_content_head}' ";
|
||||
@ -527,9 +532,10 @@ if ($all_fields) {
|
||||
|
||||
delete_cache_latest($bo_table);
|
||||
|
||||
if(function_exists('get_admin_captcha_by'))
|
||||
if (function_exists('get_admin_captcha_by')) {
|
||||
get_admin_captcha_by('remove');
|
||||
}
|
||||
|
||||
run_event('admin_board_form_update', $bo_table, $w);
|
||||
|
||||
goto_url("./board_form.php?w=u&bo_table={$bo_table}&{$qstr}");
|
||||
goto_url("./board_form.php?w=u&bo_table={$bo_table}&{$qstr}");
|
||||
|
||||
Reference in New Issue
Block a user