diff --git a/AvocadoEdition_Light/adm/_common.php b/AvocadoEdition_Light/adm/_common.php index cd443b1..76fcbd9 100644 --- a/AvocadoEdition_Light/adm/_common.php +++ b/AvocadoEdition_Light/adm/_common.php @@ -1,5 +1,4 @@ \ No newline at end of file +include_once('../common.php'); +include_once(G5_ADMIN_PATH . '/admin.lib.php'); diff --git a/AvocadoEdition_Light/adm/admin.head.php b/AvocadoEdition_Light/adm/admin.head.php index b71d652..854df94 100644 --- a/AvocadoEdition_Light/adm/admin.head.php +++ b/AvocadoEdition_Light/adm/admin.head.php @@ -1,54 +1,57 @@ "; - for($i=1; $i"; + for ($i = 1; $i < count($menu[$key]); $i++) { + if ($is_admin != 'super' && (!array_key_exists($menu[$key][$i][0], $auth) || !strstr($auth[$menu[$key][$i][0]], 'r'))) + continue; - if (($menu[$key][$i][4] == 1 && $gnb_grp_style == false) || ($menu[$key][$i][4] != 1 && $gnb_grp_style == true)) $gnb_grp_div = 'gnb_grp_div'; - else $gnb_grp_div = ''; + if (($menu[$key][$i][4] == 1 && $gnb_grp_style == false) || ($menu[$key][$i][4] != 1 && $gnb_grp_style == true)) + $gnb_grp_div = 'gnb_grp_div'; + else + $gnb_grp_div = ''; - if ($menu[$key][$i][4] == 1) $gnb_grp_style = 'gnb_grp_style'; - else $gnb_grp_style = ''; + if ($menu[$key][$i][4] == 1) + $gnb_grp_style = 'gnb_grp_style'; + else + $gnb_grp_style = ''; - $check_gnb_grp_style = ""; - if($menu[$key][$i][0] && isset($sub_menu) && $menu[$key][$i][0] == $sub_menu) { - $check_gnb_grp_style = "check"; - } - - $str .= '
  • '.$menu[$key][$i][1].'
  • '; - - $auth_menu[$menu[$key][$i][0]] = $menu[$key][$i][1]; + $check_gnb_grp_style = ""; + if ($menu[$key][$i][0] && isset($sub_menu) && $menu[$key][$i][0] == $sub_menu) { + $check_gnb_grp_style = "check"; } - $str .= ""; - return $str; + $str .= '
  • ' . $menu[$key][$i][1] . '
  • '; + + $auth_menu[$menu[$key][$i][0]] = $menu[$key][$i][1]; + } + $str .= ""; + + return $str; } ?>
    - -
    +
    - + -
    +
    diff --git a/AvocadoEdition_Light/adm/admin.lib.php b/AvocadoEdition_Light/adm/admin.lib.php index ad7112b..4b9dbee 100644 --- a/AvocadoEdition_Light/adm/admin.lib.php +++ b/AvocadoEdition_Light/adm/admin.lib.php @@ -1,5 +1,6 @@ \n"; - for ($i=0; $i선택"; - if(preg_match('#^theme/(.+)$#', $skins[$i], $match)) - $text = '(테마) '.$match[1]; - else - $text = $skins[$i]; + $str = ""; - return $str; + $str .= option_selected($skins[$i], $selected, $text); + } + $str .= ""; + return $str; } // 모바일 스킨디렉토리를 SELECT 형식으로 얻음 -function get_mobile_skin_select($skin_gubun, $id, $name, $selected='', $event='') +function get_mobile_skin_select($skin_gubun, $id, $name, $selected = '', $event = '') { - global $config; + global $config; - $skins = array(); + $skins = array(); - if(defined('G5_THEME_PATH') && $config['cf_theme']) { - $dirs = get_skin_dir($skin_gubun, G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR); - if(!empty($dirs)) { - foreach($dirs as $dir) { - $skins[] = 'theme/'.$dir; - } - } + if (defined('G5_THEME_PATH') && $config['cf_theme']) { + $dirs = get_skin_dir($skin_gubun, G5_THEME_MOBILE_PATH . '/' . G5_SKIN_DIR); + if (!empty($dirs)) { + foreach ($dirs as $dir) { + $skins[] = 'theme/' . $dir; + } } + } - $skins = array_merge($skins, get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR)); + $skins = array_merge($skins, get_skin_dir($skin_gubun, G5_MOBILE_PATH . '/' . G5_SKIN_DIR)); - $str = "\n"; + for ($i = 0; $i < count($skins); $i++) { + if ($i == 0) + $str .= ""; + if (preg_match('#^theme/(.+)$#', $skins[$i], $match)) + $text = '(테마) ' . $match[1]; + else + $text = $skins[$i]; - $str .= option_selected($skins[$i], $selected, $text); - } - $str .= ""; - return $str; + $str .= option_selected($skins[$i], $selected, $text); + } + $str .= ""; + return $str; } // 스킨경로를 얻는다 -function get_skin_dir($skin, $skin_path=G5_SKIN_PATH) +function get_skin_dir($skin, $skin_path = G5_SKIN_PATH) { - global $g5; + global $g5; - $result_array = array(); + $result_array = array(); - $dirname = $skin_path.'/'.$skin.'/'; - if(!is_dir($dirname)) - return; + $dirname = $skin_path . '/' . $skin . '/'; + if (!is_dir($dirname)) + return; - $handle = opendir($dirname); - while ($file = readdir($handle)) { - if($file == '.'||$file == '..') continue; + $handle = opendir($dirname); + while ($file = readdir($handle)) { + if ($file == '.' || $file == '..') + continue; - if (is_dir($dirname.$file)) $result_array[] = $file; - } - closedir($handle); - sort($result_array); + if (is_dir($dirname . $file)) + $result_array[] = $file; + } + closedir($handle); + sort($result_array); - return $result_array; + return $result_array; } // 테마 function get_theme_dir() { - $result_array = array(); + $result_array = array(); - $dirname = G5_PATH.'/'.G5_THEME_DIR.'/'; - $handle = opendir($dirname); - while ($file = readdir($handle)) { - if($file == '.'||$file == '..') continue; + $dirname = G5_PATH . '/' . G5_THEME_DIR . '/'; + $handle = opendir($dirname); + while ($file = readdir($handle)) { + if ($file == '.' || $file == '..') + continue; - if (is_dir($dirname.$file)) { - $theme_path = $dirname.$file; - if(is_file($theme_path.'/index.php') && is_file($theme_path.'/head.php') && is_file($theme_path.'/tail.php')) - $result_array[] = $file; - } + if (is_dir($dirname . $file)) { + $theme_path = $dirname . $file; + if (is_file($theme_path . '/index.php') && is_file($theme_path . '/head.php') && is_file($theme_path . '/tail.php')) + $result_array[] = $file; } - closedir($handle); - natsort($result_array); + } + closedir($handle); + natsort($result_array); - return $result_array; + return $result_array; } // 테마디렉토리를 SELECT 형식으로 얻음 -function get_theme_select($id, $name, $selected='', $event='') +function get_theme_select($id, $name, $selected = '', $event = '') { - global $config; + global $config; - $theme = array(); - $theme = array_merge($theme, get_theme_dir()); + $theme = array(); + $theme = array_merge($theme, get_theme_dir()); - $str = "\n"; + for ($i = 0; $i < count($theme); $i++) { + if ($i == 0) + $str .= ""; + $text = $theme[$i]; - $str .= option_selected($theme[$i], $selected, $text); - } - $str .= ""; - return $str; + $str .= option_selected($theme[$i], $selected, $text); + } + $str .= ""; + return $str; } // 테마정보 function get_theme_info($dir) { - $info = array(); - $path = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir; + $info = array(); + $path = G5_PATH . '/' . G5_THEME_DIR . '/' . $dir; - if(is_dir($path)) { - $screenshot = $path.'/screenshot.png'; - if(is_file($screenshot)) { - $size = @getimagesize($screenshot); + if (is_dir($path)) { + $screenshot = $path . '/screenshot.png'; + if (is_file($screenshot)) { + $size = @getimagesize($screenshot); - if($size[2] == 3) - $screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot); - } - - $info['screenshot'] = $screenshot_url; - - $text = $path.'/readme.txt'; - if(is_file($text)) { - $content = file($text, false); - $content = array_map('trim', $content); - - preg_match('#^Theme Name:(.+)$#i', $content[0], $m0); - preg_match('#^Theme URI:(.+)$#i', $content[1], $m1); - preg_match('#^Maker:(.+)$#i', $content[2], $m2); - preg_match('#^Maker URI:(.+)$#i', $content[3], $m3); - preg_match('#^Version:(.+)$#i', $content[4], $m4); - preg_match('#^Detail:(.+)$#i', $content[5], $m5); - preg_match('#^License:(.+)$#i', $content[6], $m6); - preg_match('#^License URI:(.+)$#i', $content[7], $m7); - - $info['theme_name'] = trim($m0[1]); - $info['theme_uri'] = trim($m1[1]); - $info['maker'] = trim($m2[1]); - $info['maker_uri'] = trim($m3[1]); - $info['version'] = trim($m4[1]); - $info['detail'] = trim($m5[1]); - $info['license'] = trim($m6[1]); - $info['license_uri'] = trim($m7[1]); - } - - if(!$info['theme_name']) - $info['theme_name'] = $dir; + if ($size[2] == 3) + $screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot); } - return $info; + $info['screenshot'] = $screenshot_url; + + $text = $path . '/readme.txt'; + if (is_file($text)) { + $content = file($text, false); + $content = array_map('trim', $content); + + preg_match('#^Theme Name:(.+)$#i', $content[0], $m0); + preg_match('#^Theme URI:(.+)$#i', $content[1], $m1); + preg_match('#^Maker:(.+)$#i', $content[2], $m2); + preg_match('#^Maker URI:(.+)$#i', $content[3], $m3); + preg_match('#^Version:(.+)$#i', $content[4], $m4); + preg_match('#^Detail:(.+)$#i', $content[5], $m5); + preg_match('#^License:(.+)$#i', $content[6], $m6); + preg_match('#^License URI:(.+)$#i', $content[7], $m7); + + $info['theme_name'] = trim($m0[1]); + $info['theme_uri'] = trim($m1[1]); + $info['maker'] = trim($m2[1]); + $info['maker_uri'] = trim($m3[1]); + $info['version'] = trim($m4[1]); + $info['detail'] = trim($m5[1]); + $info['license'] = trim($m6[1]); + $info['license_uri'] = trim($m7[1]); + } + + if (!$info['theme_name']) + $info['theme_name'] = $dir; + } + + return $info; } // 테마설정 정보 -function get_theme_config_value($dir, $key='*') +function get_theme_config_value($dir, $key = '*') { - $tconfig = array(); + $tconfig = array(); - $theme_config_file = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir.'/theme.config.php'; - if(is_file($theme_config_file)) { - include($theme_config_file); + $theme_config_file = G5_PATH . '/' . G5_THEME_DIR . '/' . $dir . '/theme.config.php'; + if (is_file($theme_config_file)) { + include($theme_config_file); - if($key == '*') { - $tconfig = $theme_config; - } else { - $keys = array_map('trim', explode(',', $key)); - foreach($keys as $v) { - $tconfig[$v] = isset($theme_config[$v]) ? trim($theme_config[$v]) : ''; - } - } + if ($key == '*') { + $tconfig = $theme_config; + } else { + $keys = array_map('trim', explode(',', $key)); + foreach ($keys as $v) { + $tconfig[$v] = isset($theme_config[$v]) ? trim($theme_config[$v]) : ''; + } } + } - return $tconfig; + return $tconfig; } // 회원권한을 SELECT 형식으로 얻음 -function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="") +function get_member_level_select($name, $start_id = 0, $end_id = 10, $selected = "", $event = "") { - global $g5; + global $g5; - $level_name[1] = "방문자"; - $level_name[2] = "멤버"; - $level_name[3] = "상위멤버"; - $level_name[10] = "운영자"; + $level_name[1] = "방문자"; + $level_name[2] = "멤버"; + $level_name[3] = "상위멤버"; + $level_name[10] = "운영자"; - $str = "\n'; - return $str; + $sql = " select mb_id from {$g5['member_table']} where mb_level >= '{$level}' "; + $result = sql_query($sql); + $str = ''; + return $str; } // 권한 검사 -function auth_check($auth, $attr, $return=false) +function auth_check($auth, $attr, $return = false) { - global $is_admin; + global $is_admin; - if ($is_admin == 'super') return; + if ($is_admin == 'super') + return; - if (!trim($auth)) { - $msg = '이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.'; - if($return) - return $msg; - else - alert($msg); - } - - $attr = strtolower($attr); - - if (!strstr($auth, $attr)) { - if ($attr == 'r') { - $msg = '읽을 권한이 없습니다.'; - if($return) - return $msg; - else - alert($msg); - } else if ($attr == 'w') { - $msg = '입력, 추가, 생성, 수정 권한이 없습니다.'; - if($return) - return $msg; - else - alert($msg); - } else if ($attr == 'd') { - $msg = '삭제 권한이 없습니다.'; - if($return) - return $msg; - else - alert($msg); - } else { - $msg = '속성이 잘못 되었습니다.'; - if($return) - return $msg; - else - alert($msg); - } + if (!trim($auth)) { + $msg = '이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.'; + if ($return) + return $msg; + else + alert($msg); + } + + $attr = strtolower($attr); + + if (!strstr($auth, $attr)) { + if ($attr == 'r') { + $msg = '읽을 권한이 없습니다.'; + if ($return) + return $msg; + else + alert($msg); + } else if ($attr == 'w') { + $msg = '입력, 추가, 생성, 수정 권한이 없습니다.'; + if ($return) + return $msg; + else + alert($msg); + } else if ($attr == 'd') { + $msg = '삭제 권한이 없습니다.'; + if ($return) + return $msg; + else + alert($msg); + } else { + $msg = '속성이 잘못 되었습니다.'; + if ($return) + return $msg; + else + alert($msg); } + } } // 작업아이콘 출력 -function icon($act, $link='', $target='_parent') +function icon($act, $link = '', $target = '_parent') { - global $g5; + global $g5; - $img = array('입력'=>'insert', '추가'=>'insert', '생성'=>'insert', '수정'=>'modify', '삭제'=>'delete', '이동'=>'move', '그룹'=>'move', '보기'=>'view', '미리보기'=>'view', '복사'=>'copy'); - $icon = ''; - if ($link) - $s = ''.$icon.''; - else - $s = $icon; - return $s; + $img = array('입력' => 'insert', '추가' => 'insert', '생성' => 'insert', '수정' => 'modify', '삭제' => 'delete', '이동' => 'move', '그룹' => 'move', '보기' => 'view', '미리보기' => 'view', '복사' => 'copy'); + $icon = ''; + if ($link) + $s = '' . $icon . ''; + else + $s = $icon; + return $s; } @@ -323,128 +333,123 @@ function icon($act, $link='', $target='_parent') // www.php.net 참고 : pal at degerstrom dot com function rm_rf($file) { - if (file_exists($file)) { - if (is_dir($file)) { - $handle = opendir($file); - while($filename = readdir($handle)) { - if ($filename != '.' && $filename != '..') - rm_rf($file.'/'.$filename); - } - closedir($handle); + if (file_exists($file)) { + if (is_dir($file)) { + $handle = opendir($file); + while ($filename = readdir($handle)) { + if ($filename != '.' && $filename != '..') + rm_rf($file . '/' . $filename); + } + closedir($handle); - @chmod($file, G5_DIR_PERMISSION); - @rmdir($file); - } else { - @chmod($file, G5_FILE_PERMISSION); - @unlink($file); - } + @chmod($file, G5_DIR_PERMISSION); + @rmdir($file); + } else { + @chmod($file, G5_FILE_PERMISSION); + @unlink($file); } + } } // 출력순서 -function order_select($fld, $sel='') +function order_select($fld, $sel = '') { - $s = ''; + for ($i = 1; $i <= 100; $i++) { + $s .= '
    +
    @@ -13,47 +14,47 @@ if (!defined('_GNUBOARD_')) exit; diff --git a/AvocadoEdition_Light/adm/ajax.token.php b/AvocadoEdition_Light/adm/ajax.token.php index f6a100a..656edd8 100644 --- a/AvocadoEdition_Light/adm/ajax.token.php +++ b/AvocadoEdition_Light/adm/ajax.token.php @@ -1,14 +1,13 @@ $error, 'url'=>G5_URL))); +if ($error) + die(json_encode(array('error' => $error, 'url' => G5_URL))); $token = get_admin_token(); -die(json_encode(array('error'=>'', 'token'=>$token, 'url'=>''))); -?> \ No newline at end of file +die(json_encode(array('error' => '', 'token' => $token, 'url' => ''))); diff --git a/AvocadoEdition_Light/adm/board_copy.php b/AvocadoEdition_Light/adm/board_copy.php index 31d02eb..88a4388 100644 --- a/AvocadoEdition_Light/adm/board_copy.php +++ b/AvocadoEdition_Light/adm/board_copy.php @@ -1,80 +1,82 @@ - +$g5['title'] = '게시판 복사'; +include_once(G5_PATH . '/head.sub.php'); +?> - + -
    -

    +
    +

    -
    - -
    +
    -
    - - +
    -
    - - - - - - - - - - - - - - - - - - - - -
    원본 테이블명
    - - -
    복사 유형 - - - - -
    -
    + + + -
    - - -
    +
    + + + + + + + + + + + + + + + + + + + + +
    원본 테이블명
    + + +
    복사 유형 + + + + +
    +
    - +
    + + +
    -
    + - + - + diff --git a/AvocadoEdition_Light/adm/board_copy_update.php b/AvocadoEdition_Light/adm/board_copy_update.php index a5a8470..5d21aa5 100644 --- a/AvocadoEdition_Light/adm/board_copy_update.php +++ b/AvocadoEdition_Light/adm/board_copy_update.php @@ -6,16 +6,16 @@ auth_check($auth[$sub_menu], 'w'); check_admin_token(); -$target_table = trim($_POST['target_table']); +$target_table = trim($_POST['target_table']); $target_subject = trim($_POST['target_subject']); if (!preg_match('/[A-Za-z0-9_]{1,20}/', $target_table)) { - alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); + alert('게시판 TABLE명은 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (20자 이내)'); } $row = sql_fetch(" select count(*) as cnt from {$g5['board_table']} where bo_table = '$target_table' "); if ($row['cnt']) - alert($target_table.'은(는) 이미 존재하는 게시판 테이블명 입니다.\\n복사할 테이블명으로 사용할 수 없습니다.'); + alert($target_table . '은(는) 이미 존재하는 게시판 테이블명 입니다.\\n복사할 테이블명으로 사용할 수 없습니다.'); // 게시판 테이블 생성 $sql = get_table_define($g5['write_prefix'] . $bo_table); @@ -26,7 +26,7 @@ $file_copy = array(); // 구조만 복사시에는 공지사항 번호는 복사하지 않는다. if ($copy_case == 'schema_only') { - $board['bo_notice'] = ''; + $board['bo_notice'] = ''; } // 게시판 정보 @@ -78,11 +78,11 @@ $sql = " insert into {$g5['board_table']} bo_mobile_skin = '{$board['bo_mobile_skin']}', bo_include_head = '{$board['bo_include_head']}', bo_include_tail = '{$board['bo_include_tail']}', - bo_content_head = '".addslashes($board['bo_content_head'])."', - bo_content_tail = '".addslashes($board['bo_content_tail'])."', - bo_mobile_content_head = '".addslashes($board['bo_mobile_content_head'])."', - bo_mobile_content_tail = '".addslashes($board['bo_mobile_content_tail'])."', - bo_insert_content = '".addslashes($board['bo_insert_content'])."', + bo_content_head = '" . addslashes($board['bo_content_head']) . "', + bo_content_tail = '" . addslashes($board['bo_content_tail']) . "', + bo_mobile_content_head = '" . addslashes($board['bo_mobile_content_head']) . "', + bo_mobile_content_tail = '" . addslashes($board['bo_mobile_content_tail']) . "', + bo_insert_content = '" . addslashes($board['bo_insert_content']) . "', bo_gallery_cols = '{$board['bo_gallery_cols']}', bo_gallery_width = '{$board['bo_gallery_width']}', bo_gallery_height = '{$board['bo_gallery_height']}', @@ -98,34 +98,34 @@ $sql = " insert into {$g5['board_table']} bo_use_cert = '{$board['bo_use_cert']}', bo_use_sns = '{$board['bo_use_sns']}', bo_sort_field = '{$board['bo_sort_field']}', - bo_1_subj = '".addslashes($board['bo_1_subj'])."', - bo_2_subj = '".addslashes($board['bo_2_subj'])."', - bo_3_subj = '".addslashes($board['bo_3_subj'])."', - bo_4_subj = '".addslashes($board['bo_4_subj'])."', - bo_5_subj = '".addslashes($board['bo_5_subj'])."', - bo_6_subj = '".addslashes($board['bo_6_subj'])."', - bo_7_subj = '".addslashes($board['bo_7_subj'])."', - bo_8_subj = '".addslashes($board['bo_8_subj'])."', - bo_9_subj = '".addslashes($board['bo_9_subj'])."', - bo_10_subj = '".addslashes($board['bo_10_subj'])."', - bo_1 = '".addslashes($board['bo_1'])."', - bo_2 = '".addslashes($board['bo_2'])."', - bo_3 = '".addslashes($board['bo_3'])."', - bo_4 = '".addslashes($board['bo_4'])."', - bo_5 = '".addslashes($board['bo_5'])."', - bo_6 = '".addslashes($board['bo_6'])."', - bo_7 = '".addslashes($board['bo_7'])."', - bo_8 = '".addslashes($board['bo_8'])."', - bo_9 = '".addslashes($board['bo_9'])."', - bo_10 = '".addslashes($board['bo_10'])."' "; + bo_1_subj = '" . addslashes($board['bo_1_subj']) . "', + bo_2_subj = '" . addslashes($board['bo_2_subj']) . "', + bo_3_subj = '" . addslashes($board['bo_3_subj']) . "', + bo_4_subj = '" . addslashes($board['bo_4_subj']) . "', + bo_5_subj = '" . addslashes($board['bo_5_subj']) . "', + bo_6_subj = '" . addslashes($board['bo_6_subj']) . "', + bo_7_subj = '" . addslashes($board['bo_7_subj']) . "', + bo_8_subj = '" . addslashes($board['bo_8_subj']) . "', + bo_9_subj = '" . addslashes($board['bo_9_subj']) . "', + bo_10_subj = '" . addslashes($board['bo_10_subj']) . "', + bo_1 = '" . addslashes($board['bo_1']) . "', + bo_2 = '" . addslashes($board['bo_2']) . "', + bo_3 = '" . addslashes($board['bo_3']) . "', + bo_4 = '" . addslashes($board['bo_4']) . "', + bo_5 = '" . addslashes($board['bo_5']) . "', + bo_6 = '" . addslashes($board['bo_6']) . "', + bo_7 = '" . addslashes($board['bo_7']) . "', + bo_8 = '" . addslashes($board['bo_8']) . "', + bo_9 = '" . addslashes($board['bo_9']) . "', + bo_10 = '" . addslashes($board['bo_10']) . "' "; sql_query($sql, false); // 게시판 폴더 생성 -@mkdir(G5_DATA_PATH.'/file/'.$target_table, G5_DIR_PERMISSION); -@chmod(G5_DATA_PATH.'/file/'.$target_table, G5_DIR_PERMISSION); +@mkdir(G5_DATA_PATH . '/file/' . $target_table, G5_DIR_PERMISSION); +@chmod(G5_DATA_PATH . '/file/' . $target_table, G5_DIR_PERMISSION); // 디렉토리에 있는 파일의 목록을 보이지 않게 한다. -$board_path = G5_DATA_PATH.'/file/'.$target_table; +$board_path = G5_DATA_PATH . '/file/' . $target_table; $file = $board_path . '/index.php'; $f = @fopen($file, 'w'); @fwrite($f, ''); @@ -134,66 +134,67 @@ $f = @fopen($file, 'w'); $copy_file = 0; if ($copy_case == 'schema_data_both') { - $d = dir(G5_DATA_PATH.'/file/'.$bo_table); - while ($entry = $d->read()) { - if ($entry == '.' || $entry == '..') continue; + $d = dir(G5_DATA_PATH . '/file/' . $bo_table); + while ($entry = $d->read()) { + if ($entry == '.' || $entry == '..') + continue; - // 김선용 201007 : - if(is_dir(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry)){ - $dd = dir(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry); - @mkdir(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry, G5_DIR_PERMISSION); - @chmod(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry, G5_DIR_PERMISSION); - while ($entry2 = $dd->read()) { - if ($entry2 == '.' || $entry2 == '..') continue; - @copy(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry.'/'.$entry2, G5_DATA_PATH.'/file/'.$target_table.'/'.$entry.'/'.$entry2); - @chmod(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry.'/'.$entry2, G5_DIR_PERMISSION); - $copy_file++; - } - $dd->close(); - } - else { - @copy(G5_DATA_PATH.'/file/'.$bo_table.'/'.$entry, G5_DATA_PATH.'/file/'.$target_table.'/'.$entry); - @chmod(G5_DATA_PATH.'/file/'.$target_table.'/'.$entry, G5_DIR_PERMISSION); - $copy_file++; - } - } - $d->close(); + // 김선용 201007 : + if (is_dir(G5_DATA_PATH . '/file/' . $bo_table . '/' . $entry)) { + $dd = dir(G5_DATA_PATH . '/file/' . $bo_table . '/' . $entry); + @mkdir(G5_DATA_PATH . '/file/' . $target_table . '/' . $entry, G5_DIR_PERMISSION); + @chmod(G5_DATA_PATH . '/file/' . $target_table . '/' . $entry, G5_DIR_PERMISSION); + while ($entry2 = $dd->read()) { + if ($entry2 == '.' || $entry2 == '..') + continue; + @copy(G5_DATA_PATH . '/file/' . $bo_table . '/' . $entry . '/' . $entry2, G5_DATA_PATH . '/file/' . $target_table . '/' . $entry . '/' . $entry2); + @chmod(G5_DATA_PATH . '/file/' . $target_table . '/' . $entry . '/' . $entry2, G5_DIR_PERMISSION); + $copy_file++; + } + $dd->close(); + } else { + @copy(G5_DATA_PATH . '/file/' . $bo_table . '/' . $entry, G5_DATA_PATH . '/file/' . $target_table . '/' . $entry); + @chmod(G5_DATA_PATH . '/file/' . $target_table . '/' . $entry, G5_DIR_PERMISSION); + $copy_file++; + } + } + $d->close(); - // 글복사 - $sql = " insert into {$g5['write_prefix']}$target_table select * from {$g5['write_prefix']}$bo_table "; - sql_query($sql, false); + // 글복사 + $sql = " insert into {$g5['write_prefix']}$target_table select * from {$g5['write_prefix']}$bo_table "; + sql_query($sql, false); - // 게시글수 저장 - $sql = " select bo_count_write, bo_count_comment from {$g5['board_table']} where bo_table = '$bo_table' "; - $row = sql_fetch($sql); - $sql = " update {$g5['board_table']} set bo_count_write = '{$row['bo_count_write']}', bo_count_comment = '{$row['bo_count_comment']}' where bo_table = '$target_table' "; - sql_query($sql, false); + // 게시글수 저장 + $sql = " select bo_count_write, bo_count_comment from {$g5['board_table']} where bo_table = '$bo_table' "; + $row = sql_fetch($sql); + $sql = " update {$g5['board_table']} set bo_count_write = '{$row['bo_count_write']}', bo_count_comment = '{$row['bo_count_comment']}' where bo_table = '$target_table' "; + sql_query($sql, false); - // 4.00.01 - // 위의 코드는 같은 테이블명을 사용하였다는 오류가 발생함. (희한하네 ㅡㅡ;) - $sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' "; - $result = sql_query($sql, false); - for ($i=0; $row=sql_fetch_array($result); $i++) - $file_copy[$i] = $row; + // 4.00.01 + // 위의 코드는 같은 테이블명을 사용하였다는 오류가 발생함. (희한하네 ㅡㅡ;) + $sql = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' "; + $result = sql_query($sql, false); + for ($i = 0; $row = sql_fetch_array($result); $i++) + $file_copy[$i] = $row; } if (count($file_copy)) { - for ($i=0; $iopener.document.location.reload();"; -alert("복사에 성공 했습니다.", './board_copy.php?bo_table='.$bo_table.'&'.$qstr); -?> \ No newline at end of file +alert("복사에 성공 했습니다.", './board_copy.php?bo_table=' . $bo_table . '&' . $qstr); diff --git a/AvocadoEdition_Light/adm/board_delete.inc.php b/AvocadoEdition_Light/adm/board_delete.inc.php index 71a3b35..44c1737 100644 --- a/AvocadoEdition_Light/adm/board_delete.inc.php +++ b/AvocadoEdition_Light/adm/board_delete.inc.php @@ -1,11 +1,15 @@ \ No newline at end of file +rm_rf(G5_DATA_PATH . '/file/' . $tmp_bo_table); diff --git a/AvocadoEdition_Light/adm/board_form.php b/AvocadoEdition_Light/adm/board_form.php index 8e44cdc..3d794f7 100644 --- a/AvocadoEdition_Light/adm/board_form.php +++ b/AvocadoEdition_Light/adm/board_form.php @@ -8,134 +8,134 @@ auth_check($auth[$sub_menu], 'w'); $sql = " select count(*) as cnt from {$g5['group_table']} "; $row = sql_fetch($sql); if (!$row['cnt']) - alert('게시판그룹이 한개 이상 생성되어야 합니다.', './boardgroup_form.php'); + alert('게시판그룹이 한개 이상 생성되어야 합니다.', './boardgroup_form.php'); $html_title = '게시판'; if (!isset($board['bo_device'])) { - // 게시판 사용 필드 추가 - // both : pc, mobile 둘다 사용 - // pc : pc 전용 사용 - // mobile : mobile 전용 사용 - // none : 사용 안함 - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_device` ENUM( 'both', 'pc', 'mobile' ) NOT NULL DEFAULT 'both' AFTER `bo_subject` ", false); + // 게시판 사용 필드 추가 + // both : pc, mobile 둘다 사용 + // pc : pc 전용 사용 + // mobile : mobile 전용 사용 + // none : 사용 안함 + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_device` ENUM( 'both', 'pc', 'mobile' ) NOT NULL DEFAULT 'both' AFTER `bo_subject` ", false); } if (!isset($board['bo_mobile_skin'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_skin` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bo_skin` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_skin` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bo_skin` ", false); } if (!isset($board['bo_gallery_width'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_gallery_width` INT NOT NULL AFTER `bo_gallery_cols`, ADD `bo_gallery_height` INT NOT NULL DEFAULT '0' AFTER `bo_gallery_width`, ADD `bo_mobile_gallery_width` INT NOT NULL DEFAULT '0' AFTER `bo_gallery_height`, ADD `bo_mobile_gallery_height` INT NOT NULL DEFAULT '0' AFTER `bo_mobile_gallery_width` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_gallery_width` INT NOT NULL AFTER `bo_gallery_cols`, ADD `bo_gallery_height` INT NOT NULL DEFAULT '0' AFTER `bo_gallery_width`, ADD `bo_mobile_gallery_width` INT NOT NULL DEFAULT '0' AFTER `bo_gallery_height`, ADD `bo_mobile_gallery_height` INT NOT NULL DEFAULT '0' AFTER `bo_mobile_gallery_width` ", false); } if (!isset($board['bo_mobile_subject_len'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_subject_len` INT(11) NOT NULL DEFAULT '0' AFTER `bo_subject_len` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_subject_len` INT(11) NOT NULL DEFAULT '0' AFTER `bo_subject_len` ", false); } if (!isset($board['bo_mobile_page_rows'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_page_rows` INT(11) NOT NULL DEFAULT '0' AFTER `bo_page_rows` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_page_rows` INT(11) NOT NULL DEFAULT '0' AFTER `bo_page_rows` ", false); } if (!isset($board['bo_mobile_content_head'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_content_head` TEXT NOT NULL AFTER `bo_content_head`, ADD `bo_mobile_content_tail` TEXT NOT NULL AFTER `bo_content_tail`", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_content_head` TEXT NOT NULL AFTER `bo_content_head`, ADD `bo_mobile_content_tail` TEXT NOT NULL AFTER `bo_content_tail`", false); } if (!isset($board['bo_use_cert'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_cert` ENUM('','cert','adult') NOT NULL DEFAULT '' AFTER `bo_use_email` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_cert` ENUM('','cert','adult') NOT NULL DEFAULT '' AFTER `bo_use_email` ", false); } if (!isset($board['bo_use_sns'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_sns` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_cert` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_sns` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_cert` ", false); - $result = sql_query(" select bo_table from `{$g5['board_table']}` "); - for ($i=0; $row=sql_fetch_array($result); $i++) { - sql_query(" ALTER TABLE `{$g5['write_prefix']}{$row['bo_table']}` + $result = sql_query(" select bo_table from `{$g5['board_table']}` "); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + sql_query(" ALTER TABLE `{$g5['write_prefix']}{$row['bo_table']}` ADD `wr_facebook_user` VARCHAR(255) NOT NULL DEFAULT '' AFTER `wr_ip`, ADD `wr_twitter_user` VARCHAR(255) NOT NULL DEFAULT '' AFTER `wr_facebook_user` ", false); - } + } } $sql = " SHOW COLUMNS FROM `{$g5['board_table']}` LIKE 'bo_use_cert' "; $row = sql_fetch($sql); -if(strpos($row['Type'], 'hp-') === false) { - sql_query(" ALTER TABLE `{$g5['board_table']}` CHANGE `bo_use_cert` `bo_use_cert` ENUM('','cert','adult','hp-cert','hp-adult') NOT NULL DEFAULT '' ", false); +if (strpos($row['Type'], 'hp-') === false) { + sql_query(" ALTER TABLE `{$g5['board_table']}` CHANGE `bo_use_cert` `bo_use_cert` ENUM('','cert','adult','hp-cert','hp-adult') NOT NULL DEFAULT '' ", false); } if (!isset($board['bo_use_list_file'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_list_file` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_list_view` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_use_list_file` TINYINT NOT NULL DEFAULT '0' AFTER `bo_use_list_view` ", false); - $result = sql_query(" select bo_table from `{$g5['board_table']}` "); - for ($i=0; $row=sql_fetch_array($result); $i++) { - sql_query(" ALTER TABLE `{$g5['write_prefix']}{$row['bo_table']}` + $result = sql_query(" select bo_table from `{$g5['board_table']}` "); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + sql_query(" ALTER TABLE `{$g5['write_prefix']}{$row['bo_table']}` ADD `wr_file` TINYINT NOT NULL DEFAULT '0' AFTER `wr_datetime` ", false); - } + } } if (!isset($board['bo_mobile_subject'])) { - sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_subject` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bo_subject` ", false); + sql_query(" ALTER TABLE `{$g5['board_table']}` ADD `bo_mobile_subject` VARCHAR(255) NOT NULL DEFAULT '' AFTER `bo_subject` ", false); } $required = ""; $readonly = ""; if ($w == '') { - $html_title .= ' 생성'; + $html_title .= ' 생성'; - $required = 'required'; - $required_valid = 'alnum_'; - $sound_only = '필수'; + $required = 'required'; + $required_valid = 'alnum_'; + $sound_only = '필수'; - $board['bo_count_delete'] = 0; - $board['bo_count_modify'] = 0; - $board['bo_read_point'] = $config['cf_read_point']; - $board['bo_write_point'] = $config['cf_write_point']; - $board['bo_comment_point'] = $config['cf_comment_point']; - $board['bo_download_point'] = $config['cf_download_point']; + $board['bo_count_delete'] = 0; + $board['bo_count_modify'] = 0; + $board['bo_read_point'] = $config['cf_read_point']; + $board['bo_write_point'] = $config['cf_write_point']; + $board['bo_comment_point'] = $config['cf_comment_point']; + $board['bo_download_point'] = $config['cf_download_point']; - $board['bo_gallery_height'] = 600; + $board['bo_gallery_height'] = 600; - $board['bo_page_rows'] = $config['cf_page_rows']; - $board['bo_mobile_page_rows'] = $config['cf_page_rows']; - $board['bo_subject_len'] = 60; - $board['bo_mobile_subject_len'] = 30; - $board['bo_new'] = 24; - $board['bo_hot'] = 100; - $board['bo_image_width'] = 600; - $board['bo_upload_count'] = 0; - $board['bo_upload_size'] = (int)ini_get("upload_max_filesize") * 1048576; - $board['bo_reply_order'] = 1; - $board['bo_use_search'] = 1; - $board['bo_skin'] = 'basic'; - $board['bo_mobile_skin'] = 'basic'; - $board['gr_id'] = $gr_id; - $board['bo_use_secret'] = 0; - $board['bo_include_head'] = '_head.php'; - $board['bo_include_tail'] = '_tail.php'; + $board['bo_page_rows'] = $config['cf_page_rows']; + $board['bo_mobile_page_rows'] = $config['cf_page_rows']; + $board['bo_subject_len'] = 60; + $board['bo_mobile_subject_len'] = 30; + $board['bo_new'] = 24; + $board['bo_hot'] = 100; + $board['bo_image_width'] = 600; + $board['bo_upload_count'] = 0; + $board['bo_upload_size'] = (int) ini_get("upload_max_filesize") * 1048576; + $board['bo_reply_order'] = 1; + $board['bo_use_search'] = 1; + $board['bo_skin'] = 'basic'; + $board['bo_mobile_skin'] = 'basic'; + $board['gr_id'] = $gr_id; + $board['bo_use_secret'] = 0; + $board['bo_include_head'] = '_head.php'; + $board['bo_include_tail'] = '_tail.php'; } else if ($w == 'u') { - $html_title .= ' 수정'; + $html_title .= ' 수정'; - if (!$board['bo_table']) - alert('존재하지 않은 게시판 입니다.'); + if (!$board['bo_table']) + alert('존재하지 않은 게시판 입니다.'); - if ($is_admin == 'group') { - if ($member['mb_id'] != $group['gr_admin']) - alert('그룹이 틀립니다.'); - } + if ($is_admin == 'group') { + if ($member['mb_id'] != $group['gr_admin']) + alert('그룹이 틀립니다.'); + } - $readonly = 'readonly'; + $readonly = 'readonly'; } if ($is_admin != 'super') { - $group = get_group($board['gr_id']); - $is_admin = is_admin($member['mb_id']); + $group = get_group($board['gr_id']); + $is_admin = is_admin($member['mb_id']); } $g5['title'] = $html_title; -include_once ('./admin.head.php'); +include_once('./admin.head.php'); $pg_anchor = '
    • 기본 설정
    • @@ -147,556 +147,577 @@ $pg_anchor = '
        ?> -
        - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - + + + + -
        - list -
        - save - -
        -
        +
        + list +
        + save + +
        +
        -
        -

        게시판 기본 설정

        - +
        +

        게시판 기본 설정

        + -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        게시판 기본 설정
        - class="frm_input " maxlength="20"> - - 영문자, 숫자, _ 만 가능 (공백없이 20자 이내) - - 게시판 바로가기 - 목록으로 - -
        - - 동일그룹 게시판목록
        - -
        - -
        - - - > - - - - - - -
        - - -
        -
        -
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        게시판 기본 설정
        + + class="frm_input " + maxlength="20"> + + 영문자, 숫자, _ 만 가능 (공백없이 20자 이내) + + 게시판 바로가기 + 목록으로 + +
        + + 동일그룹 게시판목록 +
        + +
        + +
        + + + > + + + + + + +
        + + +
        +
        +
        -
        -

        게시판 권한 설정

        - +
        +

        게시판 권한 설정

        + -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        게시판 권한 설정
        - - - - - - -
        - - - - - - -
        - - - - - - -
        - - - - - - -
        - - - - - - -
        -
        -
        +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        게시판 권한 설정
        + + + + + + +
        + + + + + + +
        + + + + + + +
        + + + + + + +
        + + + + + + +
        +
        +
        -
        -

        게시판 기능 설정

        - +
        +

        게시판 기능 설정

        + -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
        +
        게시판 기능 설정
        - - - - - - - -
        - - id="bo_use_dhtml_editor"> - 사용 - - - - - -
        - > - 사용 - - - - - -
        - - - - - - - -
        - - 업로드 파일 한개당 bytes 이하 - - - - - -
        + + + + + + + - -
        게시판 기능 설정
        -
        -
        + + + + + + + + + + + + + -
        -

        게시판 디자인/양식

        - + + + + + id="bo_use_dhtml_editor"> + 사용 + + + + + + + + -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - -
        게시판 디자인/양식
        - - - - - - -
        - - - - - - -
        - - - - - - -
        - - - - - - -
        + > + 사용 + + + + + +
        - - - - - - -
        - - - - - - -
        - - 픽셀 - - - - - -
        + + + + + + + +
        + + 업로드 파일 한개당 bytes 이하 + + + + + +
        - - 픽셀 - - - - - -
        - - - - - - - -
        -
        -
        + + +
    + -
    -

    게시판 여분필드 설정

    - +
    +

    게시판 디자인/양식

    + -
    - - - - - - - - - - - - - - - - -
    게시판 여분필드 설정
    여분필드 - - - - - - - - - -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    게시판 디자인/양식
    + + + + + + +
    + + + + + + +
    + + + + + + +
    + + + + + + +
    + + + + + + +
    + + + + + + +
    + + 픽셀 + + + + + +
    + + 픽셀 + + + + + +
    + + + + + + + +
    +
    +
    + +
    +

    게시판 여분필드 설정

    + + +
    + + + + + + + + + + + + + + + + +
    게시판 여분필드 설정
    여분필드 + + + + + + + + + +
    +
    +
    diff --git a/AvocadoEdition_Light/adm/board_list.php b/AvocadoEdition_Light/adm/board_list.php index 8a8a484..207c73f 100644 --- a/AvocadoEdition_Light/adm/board_list.php +++ b/AvocadoEdition_Light/adm/board_list.php @@ -8,29 +8,29 @@ $sql_common = " from {$g5['board_table']} a "; $sql_search = " where (1) "; if ($is_admin != "super") { - $sql_common .= " , {$g5['group_table']} b "; - $sql_search .= " and (a.gr_id = b.gr_id and b.gr_admin = '{$member['mb_id']}') "; + $sql_common .= " , {$g5['group_table']} b "; + $sql_search .= " and (a.gr_id = b.gr_id and b.gr_admin = '{$member['mb_id']}') "; } if ($stx) { - $sql_search .= " and ( "; - switch ($sfl) { - case "bo_table" : - $sql_search .= " ($sfl like '$stx%') "; - break; - case "a.gr_id" : - $sql_search .= " ($sfl = '$stx') "; - break; - default : - $sql_search .= " ($sfl like '%$stx%') "; - break; - } - $sql_search .= " ) "; + $sql_search .= " and ( "; + switch ($sfl) { + case "bo_table": + $sql_search .= " ($sfl like '$stx%') "; + break; + case "a.gr_id": + $sql_search .= " ($sfl = '$stx') "; + break; + default: + $sql_search .= " ($sfl like '%$stx%') "; + break; + } + $sql_search .= " ) "; } if (!$sst) { - $sst = "a.gr_id, a.bo_table"; - $sod = "asc"; + $sst = "a.gr_id, a.bo_table"; + $sod = "asc"; } $sql_order = " order by $sst $sod "; @@ -39,14 +39,16 @@ $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) { + $page = 1; +} // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} "; $result = sql_query($sql); -$listall = '전체목록'; +$listall = '전체목록'; $g5['title'] = '게시판관리'; include_once('./admin.head.php'); @@ -55,161 +57,167 @@ $colspan = 11; ?>
    - - 생성된 게시판수 개 + + 생성된 게시판수
    - - - - - + + + + +

    -
    - - - - - - + + + + + + + -
    - - - - - - - - - - - - - - - - - - - 수정'; - $one_copy = '복사'; +
    +
    목록
    - - 그룹TABLE스킨제목목록보기글읽기글쓰기글답변댓글쓰기관리
    + + + + + + + + + + + + + + + + + + 수정'; + $one_copy = '복사'; - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - - - - - - - - - - - - '; - ?> - -
    목록
    + + 그룹TABLE스킨제목목록보기글읽기글쓰기글답변댓글쓰기관리
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    자료가 없습니다.
    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 자료가 없습니다.'; + ?> + + + -
    -
    - build - -
    -
    - delete - -
    - - add - -
    +
    +
    + build + +
    +
    + delete + +
    + + add + +
    - + diff --git a/AvocadoEdition_Light/adm/board_thumbnail_delete.php b/AvocadoEdition_Light/adm/board_thumbnail_delete.php index 720cad4..4f935ec 100644 --- a/AvocadoEdition_Light/adm/board_thumbnail_delete.php +++ b/AvocadoEdition_Light/adm/board_thumbnail_delete.php @@ -4,49 +4,50 @@ include_once('./_common.php'); auth_check($auth[$sub_menu], 'w'); -if(!$board['bo_table']) - alert('존재하지 않는 게시판입니다.'); +if (!$board['bo_table']) + alert('존재하지 않는 게시판입니다.'); -$g5['title'] = $board['bo_subject'].' 게시판 썸네일 삭제'; +$g5['title'] = $board['bo_subject'] . ' 게시판 썸네일 삭제'; include_once('./admin.head.php'); ?>
    -

    - 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. -

    +

    + 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. +

    '; - $files = glob($dir.'/thumb-*'); - if (is_array($files)) { - foreach($files as $thumbnail) { - $cnt++; - @unlink($thumbnail); +if (is_dir($dir)) { + echo ''.PHP_EOL; - echo '

    썸네일 '.$cnt.'건의 삭제 완료됐습니다.

    '.PHP_EOL; + echo '
  • 완료됨
  • ' . PHP_EOL; + echo '

    썸네일 ' . $cnt . '건의 삭제 완료됐습니다.

    ' . PHP_EOL; } else { - echo '

    첨부파일 디렉토리가 존재하지 않습니다.

    '; + echo '

    첨부파일 디렉토리가 존재하지 않습니다.

    '; } ?> -
    게시판 수정으로 돌아가기
    +
    게시판 수정으로 돌아가기
    \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/adm/boardgroup_form.php b/AvocadoEdition_Light/adm/boardgroup_form.php index bf50428..db21a46 100644 --- a/AvocadoEdition_Light/adm/boardgroup_form.php +++ b/AvocadoEdition_Light/adm/boardgroup_form.php @@ -4,26 +4,26 @@ include_once('./_common.php'); auth_check($auth[$sub_menu], 'w'); -if ($is_admin != 'super' && $w == '') alert('최고관리자만 접근 가능합니다.'); +if ($is_admin != 'super' && $w == '') + alert('최고관리자만 접근 가능합니다.'); $html_title = '게시판그룹'; $gr_id_attr = ''; $sound_only = ''; if ($w == '') { - $gr_id_attr = 'required'; - $sound_only = ' 필수'; - $gr['gr_use_access'] = 0; - $html_title .= ' 생성'; + $gr_id_attr = 'required'; + $sound_only = ' 필수'; + $gr['gr_use_access'] = 0; + $html_title .= ' 생성'; } else if ($w == 'u') { - $gr_id_attr = 'readonly'; - $gr = sql_fetch(" select * from {$g5['group_table']} where gr_id = '$gr_id' "); - $html_title .= ' 수정'; -} -else - alert('제대로 된 값이 넘어오지 않았습니다.'); + $gr_id_attr = 'readonly'; + $gr = sql_fetch(" select * from {$g5['group_table']} where gr_id = '$gr_id' "); + $html_title .= ' 수정'; +} else + alert('제대로 된 값이 넘어오지 않았습니다.'); if (!isset($group['gr_device'])) { - sql_query(" ALTER TABLE `{$g5['group_table']}` ADD `gr_device` ENUM('both','pc','mobile') NOT NULL DEFAULT 'both' AFTER `gr_subject` ", false); + sql_query(" ALTER TABLE `{$g5['group_table']}` ADD `gr_device` ENUM('both','pc','mobile') NOT NULL DEFAULT 'both' AFTER `gr_subject` ", false); } @@ -32,82 +32,85 @@ include_once('./admin.head.php'); ?>
    -

    - 게시판을 생성하시려면 1개 이상의 게시판그룹이 필요합니다.
    - 게시판그룹을 이용하시면 더 효과적으로 게시판을 관리할 수 있습니다. -

    +

    + 게시판을 생성하시려면 1개 이상의 게시판그룹이 필요합니다.
    + 게시판그룹을 이용하시면 더 효과적으로 게시판을 관리할 수 있습니다. +

    -
    - - - - - - - - + + + + + + + + + -
    +
    - - + + - - - - - + + + - - - - + + + + - - - - - - - - + + + + + + + + +
    class=" alnum_ frm_input" maxlength="10"> + +
    class=" alnum_ frm_input" maxlength="10"> -
    - +
    + 게시판생성'; + echo '게시판생성'; ?> -
    여분필드 - - - - -
    여분필드 + + + + +
    -
    +
    -
    - list -
    - save - -
    -
    +
    + list +
    + save + +
    +
    diff --git a/AvocadoEdition_Light/adm/boardgroup_form_update.php b/AvocadoEdition_Light/adm/boardgroup_form_update.php index c29558f..8468127 100644 --- a/AvocadoEdition_Light/adm/boardgroup_form_update.php +++ b/AvocadoEdition_Light/adm/boardgroup_form_update.php @@ -3,18 +3,20 @@ $sub_menu = "300200"; include_once('./_common.php'); if ($w == 'u') - check_demo(); + check_demo(); auth_check($auth[$sub_menu], 'w'); -if ($is_admin != 'super' && $w == '') alert('최고관리자만 접근 가능합니다.'); +if ($is_admin != 'super' && $w == '') + alert('최고관리자만 접근 가능합니다.'); check_admin_token(); if (!preg_match("/^([A-Za-z0-9_]{1,10})$/", $_POST['gr_id'])) - alert('그룹 ID는 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (10자 이내)'); + alert('그룹 ID는 공백없이 영문자, 숫자, _ 만 사용 가능합니다. (10자 이내)'); -if (!$gr_subject) alert('그룹 제목을 입력하세요.'); +if (!$gr_subject) + alert('그룹 제목을 입력하세요.'); $sql_common = " gr_subject = '{$_POST['gr_subject']}', gr_device = '{$_POST['gr_device']}', @@ -40,32 +42,32 @@ $sql_common = " gr_subject = '{$_POST['gr_subject']}', gr_9 = '{$_POST['gr_9']}', gr_10 = '{$_POST['gr_10']}' "; if (isset($_POST['gr_use_access'])) - $sql_common .= ", gr_use_access = '{$_POST['gr_use_access']}' "; + $sql_common .= ", gr_use_access = '{$_POST['gr_use_access']}' "; else - $sql_common .= ", gr_use_access = '' "; + $sql_common .= ", gr_use_access = '' "; if ($w == '') { - $sql = " select count(*) as cnt from {$g5['group_table']} where gr_id = '{$_POST['gr_id']}' "; - $row = sql_fetch($sql); - if ($row['cnt']) - alert('이미 존재하는 그룹 ID 입니다.'); + $sql = " select count(*) as cnt from {$g5['group_table']} where gr_id = '{$_POST['gr_id']}' "; + $row = sql_fetch($sql); + if ($row['cnt']) + alert('이미 존재하는 그룹 ID 입니다.'); - $sql = " insert into {$g5['group_table']} + $sql = " insert into {$g5['group_table']} set gr_id = '{$_POST['gr_id']}', {$sql_common} "; - sql_query($sql); + sql_query($sql); } else if ($w == "u") { - $sql = " update {$g5['group_table']} + $sql = " update {$g5['group_table']} set {$sql_common} where gr_id = '{$_POST['gr_id']}' "; - sql_query($sql); + sql_query($sql); } else { - alert('제대로 된 값이 넘어오지 않았습니다.'); + alert('제대로 된 값이 넘어오지 않았습니다.'); } -goto_url('./boardgroup_form.php?w=u&gr_id='.$gr_id.'&'.$qstr); +goto_url('./boardgroup_form.php?w=u&gr_id=' . $gr_id . '&' . $qstr); ?> diff --git a/AvocadoEdition_Light/adm/boardgroup_list.php b/AvocadoEdition_Light/adm/boardgroup_list.php index e2d1596..963fb3f 100644 --- a/AvocadoEdition_Light/adm/boardgroup_list.php +++ b/AvocadoEdition_Light/adm/boardgroup_list.php @@ -5,52 +5,53 @@ include_once('./_common.php'); auth_check($auth[$sub_menu], 'r'); if (!isset($group['gr_device'])) { - // 게시판 그룹 사용 필드 추가 - // both : pc, mobile 둘다 사용 - // pc : pc 전용 사용 - // mobile : mobile 전용 사용 - // none : 사용 안함 - sql_query(" ALTER TABLE `{$g5['board_group_table']}` ADD `gr_device` ENUM( 'both', 'pc', 'mobile' ) NOT NULL DEFAULT 'both' AFTER `gr_subject` ", false); + // 게시판 그룹 사용 필드 추가 + // both : pc, mobile 둘다 사용 + // pc : pc 전용 사용 + // mobile : mobile 전용 사용 + // none : 사용 안함 + sql_query(" ALTER TABLE `{$g5['board_group_table']}` ADD `gr_device` ENUM( 'both', 'pc', 'mobile' ) NOT NULL DEFAULT 'both' AFTER `gr_subject` ", false); } $sql_common = " from {$g5['group_table']} "; $sql_search = " where (1) "; if ($is_admin != 'super') - $sql_search .= " and (gr_admin = '{$member['mb_id']}') "; + $sql_search .= " and (gr_admin = '{$member['mb_id']}') "; if ($stx) { - $sql_search .= " and ( "; - switch ($sfl) { - case "gr_id" : - case "gr_admin" : - $sql_search .= " ({$sfl} = '{$stx}') "; - break; - default : - $sql_search .= " ({$sfl} like '%{$stx}%') "; - break; - } - $sql_search .= " ) "; + $sql_search .= " and ( "; + switch ($sfl) { + case "gr_id": + case "gr_admin": + $sql_search .= " ({$sfl} = '{$stx}') "; + break; + default: + $sql_search .= " ({$sfl} like '%{$stx}%') "; + break; + } + $sql_search .= " ) "; } if ($sst) - $sql_order = " order by {$sst} {$sod} "; + $sql_order = " order by {$sst} {$sod} "; else - $sql_order = " order by gr_id asc "; + $sql_order = " order by gr_id asc "; $sql = " select count(*) as cnt {$sql_common} {$sql_search} {$sql_order} "; $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) + $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $sql = " select * {$sql_common} {$sql_search} {$sql_order} limit {$from_record}, {$rows} "; $result = sql_query($sql); -$listall = '처음'; +$listall = '처음'; $g5['title'] = '게시판그룹설정'; include_once('./admin.head.php'); @@ -59,160 +60,165 @@ $colspan = 10; ?>
    - - 전체그룹 개 + + 전체그룹
    - - - - - - + + + + + +

    -
    - - - - - - + + + + + + + -
    +
    - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + 수정'; + $s_upd = '수정'; - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - - - - - - - - + + + + + + + + + + - '; - ?> + if ($i == 0) + echo ''; + ?>
    목록
    +
    목록
    - 그룹아이디제목그룹관리자게시판출력 순서접속기기관리
    그룹아이디제목그룹관리자게시판출력 순서접속기기관리
    - - - - - - - - - - - - - - -
    + + + + + + + + + + + + + + + +
    자료가 없습니다.
    자료가 없습니다.
    -
    +
    -
    -
    - build - -
    -
    - delete - -
    - - add - -
    +
    +
    + build + +
    +
    + delete + +
    + + add + +

    -

    - 접근사용 옵션을 설정하시면 관리자가 지정한 회원만 해당 그룹에 접근할 수 있습니다.
    - 접근사용 옵션은 해당 그룹에 속한 모든 게시판에 적용됩니다. -

    +

    + 접근사용 옵션을 설정하시면 관리자가 지정한 회원만 해당 그룹에 접근할 수 있습니다.
    + 접근사용 옵션은 해당 그룹에 속한 모든 게시판에 적용됩니다. +

    +goto_url('./boardgroup_list.php?' . $qstr); diff --git a/AvocadoEdition_Light/adm/boardgroupmember_form.php b/AvocadoEdition_Light/adm/boardgroupmember_form.php index 4158cad..a1239d2 100644 --- a/AvocadoEdition_Light/adm/boardgroupmember_form.php +++ b/AvocadoEdition_Light/adm/boardgroupmember_form.php @@ -6,7 +6,7 @@ auth_check($auth[$sub_menu], 'w'); $mb = get_member($mb_id); if (!$mb['mb_id']) - alert('존재하지 않는 회원입니다.'); + alert('존재하지 않는 회원입니다.'); $g5['title'] = '접근가능그룹'; include_once('./admin.head.php'); @@ -14,112 +14,115 @@ include_once('./admin.head.php'); $colspan = 4; ?> -
    - - -
    -

    아이디 , 이름 , 닉네임

    + + + +
    +

    아이디 , 이름 , 닉네임 +

    -
    +
    -
    - - - - - - - - + + + + + + + + + -
    +
    - - - - + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + '; - } - ?> - + if ($i == 0) { + echo ''; + } + ?> +
    목록
    +
    목록
    - 그룹아이디그룹처리일시
    그룹아이디그룹처리일시
    - - -
    + + + +
    접근가능한 그룹이 없습니다.
    접근가능한 그룹이 없습니다.
    -
    +
    -
    +
    -
    +
    - - - - - - + + + + + +
    -
    - - - - - - - - + + + + + + + + + -
    +
    - - - - + + + - - - - - - - - - - '.$row2['cnt'].''; + + + + + + + + + + + ' . $row2['cnt'] . ''; - $mb_nick = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']); + $mb_nick = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']); - $bg = 'bg'.($i%2); - ?> - - - - - - - - - - + + + + + + + + + + '; - } - ?> - + if ($i == 0) { + echo ''; + } + ?> +
    목록
    +
    목록
    - 그룹회원아이디이름별명최종접속처리일시
    그룹회원아이디이름별명최종접속처리일시
    - - -
    + + +
    자료가 없습니다.
    자료가 없습니다.
    -
    +
    -
    +
    -
    +
    diff --git a/AvocadoEdition_Light/adm/browscap.php b/AvocadoEdition_Light/adm/browscap.php index 25f2f51..76f0125 100644 --- a/AvocadoEdition_Light/adm/browscap.php +++ b/AvocadoEdition_Light/adm/browscap.php @@ -2,44 +2,44 @@ $sub_menu = "100510"; include_once('./_common.php'); -if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) - alert('사용할 수 없는 기능입니다.', G5_ADMIN_URL); +if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) + alert('사용할 수 없는 기능입니다.', G5_ADMIN_URL); if ($is_admin != 'super') - alert('최고관리자만 접근 가능합니다.'); + alert('최고관리자만 접근 가능합니다.'); $g5['title'] = 'Browscap 업데이트'; include_once('./admin.head.php'); ?>
    -

    Browscap 정보를 업데이트하시려면 아래 업데이트 버튼을 클릭해 주세요.

    - +

    Browscap 정보를 업데이트하시려면 아래 업데이트 버튼을 클릭해 주세요.

    +
    \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/adm/browscap_convert.php b/AvocadoEdition_Light/adm/browscap_convert.php index edf3b0d..839b4ce 100644 --- a/AvocadoEdition_Light/adm/browscap_convert.php +++ b/AvocadoEdition_Light/adm/browscap_convert.php @@ -2,45 +2,45 @@ $sub_menu = "100520"; include_once('./_common.php'); -if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) - alert('사용할 수 없는 기능입니다.', G5_ADMIN_URL); +if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) + alert('사용할 수 없는 기능입니다.', G5_ADMIN_URL); if ($is_admin != 'super') - alert('최고관리자만 접근 가능합니다.'); + alert('최고관리자만 접근 가능합니다.'); $rows = preg_replace('#[^0-9]#', '', $_GET['rows']); -if(!$rows) - $rows = 100; +if (!$rows) + $rows = 100; $g5['title'] = '접속로그 변환'; include_once('./admin.head.php'); ?>
    -

    접속로그 정보를 Browscap 정보로 변환하시려면 아래 업데이트 버튼을 클릭해 주세요.

    - +

    접속로그 정보를 Browscap 정보로 변환하시려면 아래 업데이트 버튼을 클릭해 주세요.

    +
    \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/adm/browscap_converter.php b/AvocadoEdition_Light/adm/browscap_converter.php index f7572ed..4202534 100644 --- a/AvocadoEdition_Light/adm/browscap_converter.php +++ b/AvocadoEdition_Light/adm/browscap_converter.php @@ -5,32 +5,32 @@ include_once('./_common.php'); // clean the output buffer ob_end_clean(); -if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) - die('사용할 수 없는 기능입니다.'); +if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) + die('사용할 수 없는 기능입니다.'); -if($is_admin != 'super') - die('최고관리자로 로그인 후 실행해 주세요.'); +if ($is_admin != 'super') + die('최고관리자로 로그인 후 실행해 주세요.'); // browscap cache 파일 체크 -if(!is_file(G5_DATA_PATH.'/cache/browscap_cache.php')) { - echo '

    Browscap 정보가 없습니다. 아래 링크로 이동해 Browscap 정보를 업데이트 하세요.

    '.PHP_EOL; - echo '

    Browscap 업데이트

    '.PHP_EOL; - exit; +if (!is_file(G5_DATA_PATH . '/cache/browscap_cache.php')) { + echo '

    Browscap 정보가 없습니다. 아래 링크로 이동해 Browscap 정보를 업데이트 하세요.

    ' . PHP_EOL; + echo '

    Browscap 업데이트

    ' . PHP_EOL; + exit; } -include_once(G5_PLUGIN_PATH.'/browscap/Browscap.php'); -$browscap = new phpbrowscap\Browscap(G5_DATA_PATH.'/cache'); +include_once(G5_PLUGIN_PATH . '/browscap/Browscap.php'); +$browscap = new phpbrowscap\Browscap(G5_DATA_PATH . '/cache'); $browscap->doAutoUpdate = false; $browscap->cacheFilename = 'browscap_cache.php'; // 데이터 변환 $rows = preg_replace('#[^0-9]#', '', $_GET['rows']); -if(!$rows) - $rows = 100; +if (!$rows) + $rows = 100; $sql_common = " from {$g5['visit_table']} where vi_agent <> '' and ( vi_browser = '' or vi_os = '' or vi_device = '' ) "; -$sql_order = " order by vi_id desc "; -$sql_limit = " limit 0, $rows "; +$sql_order = " order by vi_id desc "; +$sql_limit = " limit 0, $rows "; $sql = " select count(vi_id) as cnt $sql_common "; $row = sql_fetch($sql); @@ -43,33 +43,32 @@ $sql = " select vi_id, vi_agent, vi_browser, vi_os, vi_device $result = sql_query($sql); $cnt = 0; -for($i=0; $row=sql_fetch_array($result); $i++) { - $info = $browscap->getBrowser($row['vi_agent']); +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $info = $browscap->getBrowser($row['vi_agent']); - $brow = $row['vi_browser']; - if(!$brow) - $brow = $info->Comment; + $brow = $row['vi_browser']; + if (!$brow) + $brow = $info->Comment; - $os = $row['vi_os']; - if(!$os) - $os = $info->Platform; + $os = $row['vi_os']; + if (!$os) + $os = $info->Platform; - $device = $row['vi_device']; - if(!$device) - $device = $info->Device_Type; + $device = $row['vi_device']; + if (!$device) + $device = $info->Device_Type; - $sql2 = " update {$g5['visit_table']} + $sql2 = " update {$g5['visit_table']} set vi_browser = '$brow', vi_os = '$os', vi_device = '$device' where vi_id = '{$row['vi_id']}' "; - sql_query($sql2); + sql_query($sql2); - $cnt++; + $cnt++; } -if(($total_count - $cnt) == 0 || $total_count == 0) - echo '

    변환완료

    '; +if (($total_count - $cnt) == 0 || $total_count == 0) + echo '

    변환완료

    '; else - echo '

    총 '.number_format($total_count).'건 중 '.number_format($cnt).'건 변환완료

    접속로그를 추가로 변환하시려면 아래 업데이트 버튼을 클릭해 주세요.

    '; -?> \ No newline at end of file + echo '

    총 ' . number_format($total_count) . '건 중 ' . number_format($cnt) . '건 변환완료

    접속로그를 추가로 변환하시려면 아래 업데이트 버튼을 클릭해 주세요.

    '; diff --git a/AvocadoEdition_Light/adm/browscap_update.php b/AvocadoEdition_Light/adm/browscap_update.php index e27a739..02e0c74 100644 --- a/AvocadoEdition_Light/adm/browscap_update.php +++ b/AvocadoEdition_Light/adm/browscap_update.php @@ -7,18 +7,17 @@ include_once('./_common.php'); // clean the output buffer ob_end_clean(); -if(!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) - die('사용할 수 없는 기능입니다.'); +if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) + die('사용할 수 없는 기능입니다.'); if ($is_admin != 'super') - die('최고관리자만 접근 가능합니다.'); + die('최고관리자만 접근 가능합니다.'); -include_once(G5_PLUGIN_PATH.'/browscap/Browscap.php'); +include_once(G5_PLUGIN_PATH . '/browscap/Browscap.php'); -$browscap = new phpbrowscap\Browscap(G5_DATA_PATH.'/cache'); +$browscap = new phpbrowscap\Browscap(G5_DATA_PATH . '/cache'); $browscap->updateMethod = 'cURL'; $browscap->cacheFilename = 'browscap_cache.php'; $browscap->updateCache(); die(''); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/adm/cache_file_delete.php b/AvocadoEdition_Light/adm/cache_file_delete.php index f7981b7..f6a5325 100644 --- a/AvocadoEdition_Light/adm/cache_file_delete.php +++ b/AvocadoEdition_Light/adm/cache_file_delete.php @@ -1,48 +1,48 @@
    -

    - 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. -

    +

    + 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. +

    캐시디렉토리를 열지못했습니다.

    '; +if (!$dir = @opendir(G5_DATA_PATH . '/cache')) { + echo '

    캐시디렉토리를 열지못했습니다.

    '; } -$cnt=0; -echo '' . PHP_EOL; +echo '

    최신글 캐시파일 ' . $cnt . '건 삭제 완료됐습니다.
    프로그램의 실행을 끝마치셔도 좋습니다.

    ' . PHP_EOL; ?> \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/adm/captcha_file_delete.php b/AvocadoEdition_Light/adm/captcha_file_delete.php index d8b8055..29ae8a6 100644 --- a/AvocadoEdition_Light/adm/captcha_file_delete.php +++ b/AvocadoEdition_Light/adm/captcha_file_delete.php @@ -3,51 +3,52 @@ $sub_menu = '100910'; include_once('./_common.php'); if ($is_admin != 'super') - alert('최고관리자만 접근 가능합니다.', G5_URL); + alert('최고관리자만 접근 가능합니다.', G5_URL); $g5['title'] = '캡챠파일 일괄삭제'; include_once('./admin.head.php'); ?>
    -

    - 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. -

    +

    + 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. +

    캐시디렉토리를 열지못했습니다.

    '; +if (!$dir = @opendir(G5_DATA_PATH . '/cache')) { + echo '

    캐시디렉토리를 열지못했습니다.

    '; } -$cnt=0; -echo '' . PHP_EOL; +echo '

    캡챠파일 ' . $cnt . '건의 삭제 완료됐습니다.
    프로그램의 실행을 끝마치셔도 좋습니다.

    ' . PHP_EOL; ?> \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/adm/config_form.php b/AvocadoEdition_Light/adm/config_form.php index 8a84cea..4612cbc 100644 --- a/AvocadoEdition_Light/adm/config_form.php +++ b/AvocadoEdition_Light/adm/config_form.php @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/adm/contentform.php b/AvocadoEdition_Light/adm/contentform.php index 5ed2516..ca027ef 100644 --- a/AvocadoEdition_Light/adm/contentform.php +++ b/AvocadoEdition_Light/adm/contentform.php @@ -6,201 +6,202 @@ include_once(G5_EDITOR_LIB); auth_check($auth[$sub_menu], "w"); // 상단, 하단 파일경로 필드 추가 -if(!sql_query(" select co_include_head from {$g5['content_table']} limit 1 ", false)) { - $sql = " ALTER TABLE `{$g5['content_table']}` ADD `co_include_head` VARCHAR( 255 ) NOT NULL , +if (!sql_query(" select co_include_head from {$g5['content_table']} limit 1 ", false)) { + $sql = " ALTER TABLE `{$g5['content_table']}` ADD `co_include_head` VARCHAR( 255 ) NOT NULL , ADD `co_include_tail` VARCHAR( 255 ) NOT NULL "; - sql_query($sql, false); + sql_query($sql, false); } // html purifier 사용여부 필드 -if(!sql_query(" select co_tag_filter_use from {$g5['content_table']} limit 1 ", false)) { - sql_query(" ALTER TABLE `{$g5['content_table']}` +if (!sql_query(" select co_tag_filter_use from {$g5['content_table']} limit 1 ", false)) { + sql_query(" ALTER TABLE `{$g5['content_table']}` ADD `co_tag_filter_use` tinyint(4) NOT NULL DEFAULT '0' AFTER `co_content` ", true); - sql_query(" update {$g5['content_table']} set co_tag_filter_use = '1' "); + sql_query(" update {$g5['content_table']} set co_tag_filter_use = '1' "); } // 모바일 내용 추가 -if(!sql_query(" select co_mobile_content from {$g5['content_table']} limit 1", false)) { - sql_query(" ALTER TABLE `{$g5['content_table']}` +if (!sql_query(" select co_mobile_content from {$g5['content_table']} limit 1", false)) { + sql_query(" ALTER TABLE `{$g5['content_table']}` ADD `co_mobile_content` longtext NOT NULL AFTER `co_content` ", true); } // 스킨 설정 추가 -if(!sql_query(" select co_skin from {$g5['content_table']} limit 1 ", false)) { - sql_query(" ALTER TABLE `{$g5['content_table']}` +if (!sql_query(" select co_skin from {$g5['content_table']} limit 1 ", false)) { + sql_query(" ALTER TABLE `{$g5['content_table']}` ADD `co_skin` varchar(255) NOT NULL DEFAULT '' AFTER `co_mobile_content`, ADD `co_mobile_skin` varchar(255) NOT NULL DEFAULT '' AFTER `co_skin` ", true); - sql_query(" update {$g5['content_table']} set co_skin = 'basic', co_mobile_skin = 'basic' "); + sql_query(" update {$g5['content_table']} set co_skin = 'basic', co_mobile_skin = 'basic' "); } $html_title = "내용"; -$g5['title'] = $html_title.' 관리'; +$g5['title'] = $html_title . ' 관리'; -if ($w == "u") -{ - $html_title .= " 수정"; - $readonly = " readonly"; +if ($w == "u") { + $html_title .= " 수정"; + $readonly = " readonly"; - $sql = " select * from {$g5['content_table']} where co_id = '$co_id' "; - $co = sql_fetch($sql); - if (!$co['co_id']) - alert('등록된 자료가 없습니다.'); -} -else -{ - $html_title .= ' 입력'; - $co['co_html'] = 2; - $co['co_skin'] = 'basic'; - $co['co_mobile_skin'] = 'basic'; + $sql = " select * from {$g5['content_table']} where co_id = '$co_id' "; + $co = sql_fetch($sql); + if (!$co['co_id']) + alert('등록된 자료가 없습니다.'); +} else { + $html_title .= ' 입력'; + $co['co_html'] = 2; + $co['co_skin'] = 'basic'; + $co['co_mobile_skin'] = 'basic'; } -include_once (G5_ADMIN_PATH.'/admin.head.php'); +include_once(G5_ADMIN_PATH . '/admin.head.php'); ?> -
    - - - + + + + -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +
    목록
    - - class="required frm_input" size="20" maxlength="20"> - 내용확인 -
    내용
    - -
    - - -
    - - -
    - - -
    - - 750) - $width = 750; - else - $width = $size[0]; +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - -
    목록
    + + class="required frm_input" size="20" maxlength="20"> + 내용확인 +
    내용
    + +
    + + +
    + + +
    + + +
    + + 750) + $width = 750; + else + $width = $size[0]; - echo ' '; - $himg_str = ''; - } - if ($himg_str) { - echo ''; - } - ?> -
    - - 750) - $width = 750; - else - $width = $size[0]; + echo ' '; + $himg_str = ''; + } + if ($himg_str) { + echo ''; + } + ?> +
    + + 750) + $width = 750; + else + $width = $size[0]; - echo ' '; - $timg_str = ''; - } - if ($timg_str) { - echo ''; - } - ?> -
    -
    + echo ' '; + $timg_str = ''; + } + if ($timg_str) { + echo ''; + } + ?> +
    +
    -
    - list -
    - save - -
    -
    +
    + list +
    + save + +
    +
    diff --git a/AvocadoEdition_Light/adm/contentformupdate.php b/AvocadoEdition_Light/adm/contentformupdate.php index 2abf659..aca5754 100644 --- a/AvocadoEdition_Light/adm/contentformupdate.php +++ b/AvocadoEdition_Light/adm/contentformupdate.php @@ -3,31 +3,33 @@ $sub_menu = '300600'; include_once('./_common.php'); if ($w == "u" || $w == "d") - check_demo(); + check_demo(); if ($w == 'd') - auth_check($auth[$sub_menu], "d"); + auth_check($auth[$sub_menu], "d"); else - auth_check($auth[$sub_menu], "w"); + auth_check($auth[$sub_menu], "w"); check_admin_token(); -@mkdir(G5_DATA_PATH."/content", G5_DIR_PERMISSION); -@chmod(G5_DATA_PATH."/content", G5_DIR_PERMISSION); +@mkdir(G5_DATA_PATH . "/content", G5_DIR_PERMISSION); +@chmod(G5_DATA_PATH . "/content", G5_DIR_PERMISSION); -if ($co_himg_del) @unlink(G5_DATA_PATH."/content/{$co_id}_h"); -if ($co_timg_del) @unlink(G5_DATA_PATH."/content/{$co_id}_t"); +if ($co_himg_del) + @unlink(G5_DATA_PATH . "/content/{$co_id}_h"); +if ($co_timg_del) + @unlink(G5_DATA_PATH . "/content/{$co_id}_t"); $error_msg = ''; -if( $co_include_head && ! is_include_path_check($co_include_head) ){ - $co_include_head = ''; - $error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.'; +if ($co_include_head && !is_include_path_check($co_include_head)) { + $co_include_head = ''; + $error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 상단 파일 경로에 포함시킬수 없습니다.'; } -if( $co_include_tail && ! is_include_path_check($co_include_tail) ){ - $co_include_tail = ''; - $error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.'; +if ($co_include_tail && !is_include_path_check($co_include_tail)) { + $co_include_tail = ''; + $error_msg = '/data/file/ 또는 /data/editor/ 포함된 문자를 하단 파일 경로에 포함시킬수 없습니다.'; } $sql_common = " co_include_head = '$co_include_head', @@ -40,60 +42,50 @@ $sql_common = " co_include_head = '$co_include_head', co_skin = '$co_skin', co_mobile_skin = '$co_mobile_skin' "; -if ($w == "") -{ - //if(eregi("[^a-z0-9_]", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다."); - if(preg_match("/[^a-z0-9_]/i", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다."); +if ($w == "") { + //if(eregi("[^a-z0-9_]", $co_id)) alert("ID 는 영문자, 숫자, _ 만 가능합니다."); + if (preg_match("/[^a-z0-9_]/i", $co_id)) + alert("ID 는 영문자, 숫자, _ 만 가능합니다."); - $sql = " select co_id from {$g5['content_table']} where co_id = '$co_id' "; - $row = sql_fetch($sql); - if ($row['co_id']) - alert("이미 같은 ID로 등록된 내용이 있습니다."); + $sql = " select co_id from {$g5['content_table']} where co_id = '$co_id' "; + $row = sql_fetch($sql); + if ($row['co_id']) + alert("이미 같은 ID로 등록된 내용이 있습니다."); - $sql = " insert {$g5['content_table']} + $sql = " insert {$g5['content_table']} set co_id = '$co_id', $sql_common "; - sql_query($sql); -} -else if ($w == "u") -{ - $sql = " update {$g5['content_table']} + sql_query($sql); +} else if ($w == "u") { + $sql = " update {$g5['content_table']} set $sql_common where co_id = '$co_id' "; - sql_query($sql); -} -else if ($w == "d") -{ - @unlink(G5_DATA_PATH."/content/{$co_id}_h"); - @unlink(G5_DATA_PATH."/content/{$co_id}_t"); + sql_query($sql); +} else if ($w == "d") { + @unlink(G5_DATA_PATH . "/content/{$co_id}_h"); + @unlink(G5_DATA_PATH . "/content/{$co_id}_t"); - $sql = " delete from {$g5['content_table']} where co_id = '$co_id' "; - sql_query($sql); + $sql = " delete from {$g5['content_table']} where co_id = '$co_id' "; + sql_query($sql); } -if ($w == "" || $w == "u") -{ - if ($_FILES['co_himg']['name']) - { - $dest_path = G5_DATA_PATH."/content/".$co_id."_h"; - @move_uploaded_file($_FILES['co_himg']['tmp_name'], $dest_path); - @chmod($dest_path, G5_FILE_PERMISSION); - } - if ($_FILES['co_timg']['name']) - { - $dest_path = G5_DATA_PATH."/content/".$co_id."_t"; - @move_uploaded_file($_FILES['co_timg']['tmp_name'], $dest_path); - @chmod($dest_path, G5_FILE_PERMISSION); - } +if ($w == "" || $w == "u") { + if ($_FILES['co_himg']['name']) { + $dest_path = G5_DATA_PATH . "/content/" . $co_id . "_h"; + @move_uploaded_file($_FILES['co_himg']['tmp_name'], $dest_path); + @chmod($dest_path, G5_FILE_PERMISSION); + } + if ($_FILES['co_timg']['name']) { + $dest_path = G5_DATA_PATH . "/content/" . $co_id . "_t"; + @move_uploaded_file($_FILES['co_timg']['tmp_name'], $dest_path); + @chmod($dest_path, G5_FILE_PERMISSION); + } - if( $error_msg ){ - alert($error_msg, "./contentform.php?w=u&co_id=$co_id"); - } else { - goto_url("./contentform.php?w=u&co_id=$co_id"); - } + if ($error_msg) { + alert($error_msg, "./contentform.php?w=u&co_id=$co_id"); + } else { + goto_url("./contentform.php?w=u&co_id=$co_id"); + } +} else { + goto_url("./contentlist.php"); } -else -{ - goto_url("./contentlist.php"); -} -?> diff --git a/AvocadoEdition_Light/adm/contentlist.php b/AvocadoEdition_Light/adm/contentlist.php index 2413bc1..64f56db 100644 --- a/AvocadoEdition_Light/adm/contentlist.php +++ b/AvocadoEdition_Light/adm/contentlist.php @@ -4,15 +4,15 @@ include_once('./_common.php'); auth_check($auth[$sub_menu], "r"); -if( !isset($g5['content_table']) ){ - die('/data/dbconfig.php 파일에 $g5[\'content_table\'] = G5_TABLE_PREFIX.\'content\'; 를 추가해 주세요.'); +if (!isset($g5['content_table'])) { + die('/data/dbconfig.php 파일에 $g5[\'content_table\'] = G5_TABLE_PREFIX.\'content\'; 를 추가해 주세요.'); } //내용(컨텐츠)정보 테이블이 있는지 검사한다. -if(!sql_query(" DESCRIBE {$g5['content_table']} ", false)) { - if(sql_query(" DESCRIBE {$g5['g5_shop_content_table']} ", false)) { - sql_query(" ALTER TABLE {$g5['g5_shop_content_table']} RENAME TO `{$g5['content_table']}` ;", false); - } else { - $query_cp = sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['content_table']}` ( +if (!sql_query(" DESCRIBE {$g5['content_table']} ", false)) { + if (sql_query(" DESCRIBE {$g5['g5_shop_content_table']} ", false)) { + sql_query(" ALTER TABLE {$g5['g5_shop_content_table']} RENAME TO `{$g5['content_table']}` ;", false); + } else { + $query_cp = sql_query(" CREATE TABLE IF NOT EXISTS `{$g5['content_table']}` ( `co_id` varchar(20) NOT NULL DEFAULT '', `co_html` tinyint(4) NOT NULL DEFAULT '0', `co_subject` varchar(255) NOT NULL DEFAULT '', @@ -23,15 +23,15 @@ if(!sql_query(" DESCRIBE {$g5['content_table']} ", false)) { PRIMARY KEY (`co_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ", true); - // 내용관리 생성 - sql_query(" insert into `{$g5['content_table']}` set co_id = 'company', co_html = '1', co_subject = '회사소개', co_content= '

    회사소개에 대한 내용을 입력하십시오.

    ' ", false ); - sql_query(" insert into `{$g5['content_table']}` set co_id = 'privacy', co_html = '1', co_subject = '개인정보 처리방침', co_content= '

    개인정보 처리방침에 대한 내용을 입력하십시오.

    ' ", false ); - sql_query(" insert into `{$g5['content_table']}` set co_id = 'provision', co_html = '1', co_subject = '서비스 이용약관', co_content= '

    서비스 이용약관에 대한 내용을 입력하십시오.

    ' ", false ); - } + // 내용관리 생성 + sql_query(" insert into `{$g5['content_table']}` set co_id = 'company', co_html = '1', co_subject = '회사소개', co_content= '

    회사소개에 대한 내용을 입력하십시오.

    ' ", false); + sql_query(" insert into `{$g5['content_table']}` set co_id = 'privacy', co_html = '1', co_subject = '개인정보 처리방침', co_content= '

    개인정보 처리방침에 대한 내용을 입력하십시오.

    ' ", false); + sql_query(" insert into `{$g5['content_table']}` set co_id = 'provision', co_html = '1', co_subject = '서비스 이용약관', co_content= '

    서비스 이용약관에 대한 내용을 입력하십시오.

    ' ", false); + } } $g5['title'] = '내용관리'; -include_once (G5_ADMIN_PATH.'/admin.head.php'); +include_once(G5_ADMIN_PATH . '/admin.head.php'); $sql_common = " from {$g5['content_table']} where co_subject != '' "; @@ -41,8 +41,10 @@ $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) { + $page = 1; +} // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $sql = "select * $sql_common order by co_id limit $from_record, {$config['cf_page_rows']} "; @@ -50,56 +52,59 @@ $result = sql_query($sql); ?>
    - 1) {?>처음으로 - 전체 내용 + 1) { ?>처음으로 + 전체 내용
    - add + add

    - - - - - - - - - - - - - - - - - - - '; - } - ?> - -
    목록
    ID제목미리보기관리
    - 보기 - - 수정 -   - 삭제 -
    자료가 한건도 없습니다.
    + + + + + + + + + + + + + + + + + + + '; + } + ?> + +
    목록
    ID제목미리보기관리
    + 보기 + + 수정 +   + 삭제 +
    자료가 한건도 없습니다.
    +include_once(G5_ADMIN_PATH . '/admin.tail.php'); diff --git a/AvocadoEdition_Light/adm/design_form.php b/AvocadoEdition_Light/adm/design_form.php index be5a2b7..cf0189f 100644 --- a/AvocadoEdition_Light/adm/design_form.php +++ b/AvocadoEdition_Light/adm/design_form.php @@ -233,8 +233,8 @@ $editor_list = array(); - 외부경로   + 외부경로   > @@ -295,9 +295,11 @@ $editor_list = array(); - -    @@ -307,7 +309,8 @@ $editor_list = array(); - +    @@ -365,9 +368,11 @@ $editor_list = array(); - - - - - @@ -692,8 +700,8 @@ $editor_list = array(); - 외부경로   + 외부경로   @@ -701,7 +709,8 @@ $editor_list = array(); 안내문 내용 - + @@ -714,11 +723,11 @@ $editor_list = array(); placeholder="#색상코드" />%    - 글자크기   px + 글자크기   px    - 글자모양   + 글자모양   > @@ -1060,14 +1069,14 @@ $editor_list = array(); 좌측상단 px    - 우측상단 px + 우측상단 px    - 우측하단 px + 우측하단 px    - 좌측하단 px + 좌측하단 px > @@ -1480,7 +1489,8 @@ $editor_list = array(); - @@ -1497,7 +1507,8 @@ $editor_list = array(); 배경크기   - - - - - - +
    + + + + + + + -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
    +
    - class="frm_input " size="15" minlength="3" maxlength="20"> - 접근가능그룹보기 - class="frm_input " size="15" maxlength="20">
    - > - - > - -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - + + - - + + - + + + - - - - - - + + + + + + - -
    + + class="frm_input " size="15" minlength="3" maxlength="20"> + 접근가능그룹보기 + + class="frm_input " size="15" maxlength="20">
    + > + + > + +
    회원가입일최근접속일
    IP
    인증일시 - - - - - - - -
    회원가입일최근접속일
    IP
    인증일시 + + + + + + + +
    추천인
    추천인 + +
    - - " id="mb_leave_date_set_today" onclick="if (this.form.mb_leave_date.value==this.form.mb_leave_date.defaultValue) { +
    + + " id="mb_leave_date_set_today" + onclick="if (this.form.mb_leave_date.value==this.form.mb_leave_date.defaultValue) { this.form.mb_leave_date.value=this.value; } else { this.form.mb_leave_date.value=this.form.mb_leave_date.defaultValue; }"> - - 접근차단일자 - - " id="mb_intercept_date_set_today" onclick="if + + 접근차단일자 + + " id="mb_intercept_date_set_today" onclick="if (this.form.mb_intercept_date.value==this.form.mb_intercept_date.defaultValue) { this.form.mb_intercept_date.value=this.value; } else { this.form.mb_intercept_date.value=this.form.mb_intercept_date.defaultValue; }"> - -
    -
    + + + -
    - list -
    - save - -
    -
    +
    + list +
    + save + +
    +
    = $member['mb_level']) - alert('자신보다 권한이 높거나 같은 회원은 수정할 수 없습니다.'); + if ($is_admin != 'super' && $mb['mb_level'] >= $member['mb_level']) + alert('자신보다 권한이 높거나 같은 회원은 수정할 수 없습니다.'); - if ($_POST['mb_id'] == $member['mb_id'] && $_POST['mb_level'] != $mb['mb_level']) - alert($mb['mb_id'].' : 로그인 중인 관리자 레벨은 수정 할 수 없습니다.'); + if ($_POST['mb_id'] == $member['mb_id'] && $_POST['mb_level'] != $mb['mb_level']) + alert($mb['mb_id'] . ' : 로그인 중인 관리자 레벨은 수정 할 수 없습니다.'); - // 닉네임중복체크 - $sql = " select mb_id, mb_name, mb_nick, mb_email from {$g5['member_table']} where mb_nick = '{$_POST['mb_nick']}' and mb_id <> '{$mb_id}' "; - $row = sql_fetch($sql); - if ($row['mb_id']) - alert('이미 존재하는 닉네임입니다.\\nID : '.$row['mb_id'].'\\n이름 : '.$row['mb_name'].'\\n닉네임 : '.$row['mb_nick'].'\\n메일 : '.$row['mb_email']); + // 닉네임중복체크 + $sql = " select mb_id, mb_name, mb_nick, mb_email from {$g5['member_table']} where mb_nick = '{$_POST['mb_nick']}' and mb_id <> '{$mb_id}' "; + $row = sql_fetch($sql); + if ($row['mb_id']) + alert('이미 존재하는 닉네임입니다.\\nID : ' . $row['mb_id'] . '\\n이름 : ' . $row['mb_name'] . '\\n닉네임 : ' . $row['mb_nick'] . '\\n메일 : ' . $row['mb_email']); - // 이메일중복체크 - $sql = " select mb_id, mb_name, mb_nick, mb_email from {$g5['member_table']} where mb_email = '{$_POST['mb_email']}' and mb_id <> '$mb_id' "; - $row = sql_fetch($sql); - if ($row['mb_id']) - alert('이미 존재하는 이메일입니다.\\nID : '.$row['mb_id'].'\\n이름 : '.$row['mb_name'].'\\n닉네임 : '.$row['mb_nick'].'\\n메일 : '.$row['mb_email']); + // 이메일중복체크 + $sql = " select mb_id, mb_name, mb_nick, mb_email from {$g5['member_table']} where mb_email = '{$_POST['mb_email']}' and mb_id <> '$mb_id' "; + $row = sql_fetch($sql); + if ($row['mb_id']) + alert('이미 존재하는 이메일입니다.\\nID : ' . $row['mb_id'] . '\\n이름 : ' . $row['mb_name'] . '\\n닉네임 : ' . $row['mb_nick'] . '\\n메일 : ' . $row['mb_email']); - $mb_dir = substr($mb_id,0,2); + $mb_dir = substr($mb_id, 0, 2); - // 회원 아이콘 삭제 - if ($del_mb_icon) - @unlink(G5_DATA_PATH.'/member/'.$mb_dir.'/'.$mb_id.'.gif'); + // 회원 아이콘 삭제 + if ($del_mb_icon) + @unlink(G5_DATA_PATH . '/member/' . $mb_dir . '/' . $mb_id . '.gif'); - // 아이콘 업로드 - if (is_uploaded_file($_FILES['mb_icon']['tmp_name'])) { - if (!preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) { - alert($_FILES['mb_icon']['name'] . '은(는) gif 파일이 아닙니다.'); - } - - if (preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) { - @mkdir(G5_DATA_PATH.'/member/'.$mb_dir, G5_DIR_PERMISSION); - @chmod(G5_DATA_PATH.'/member/'.$mb_dir, G5_DIR_PERMISSION); - - $dest_path = G5_DATA_PATH.'/member/'.$mb_dir.'/'.$mb_id.'.gif'; - - move_uploaded_file($_FILES['mb_icon']['tmp_name'], $dest_path); - chmod($dest_path, G5_FILE_PERMISSION); - - if (file_exists($dest_path)) { - $size = getimagesize($dest_path); - // 아이콘의 폭 또는 높이가 설정값 보다 크다면 이미 업로드 된 아이콘 삭제 - if ($size[0] > $config['cf_member_icon_width'] || $size[1] > $config['cf_member_icon_height']) { - @unlink($dest_path); - } - } - } + // 아이콘 업로드 + if (is_uploaded_file($_FILES['mb_icon']['tmp_name'])) { + if (!preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) { + alert($_FILES['mb_icon']['name'] . '은(는) gif 파일이 아닙니다.'); } - if ($mb_password) - $sql_password = " , mb_password = '".get_encrypt_string($mb_password)."' "; - else - $sql_password = ""; + if (preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) { + @mkdir(G5_DATA_PATH . '/member/' . $mb_dir, G5_DIR_PERMISSION); + @chmod(G5_DATA_PATH . '/member/' . $mb_dir, G5_DIR_PERMISSION); - if ($passive_certify) - $sql_certify = " , mb_email_certify = '".G5_TIME_YMDHIS."' "; - else - $sql_certify = ""; + $dest_path = G5_DATA_PATH . '/member/' . $mb_dir . '/' . $mb_id . '.gif'; - $sql = " update {$g5['member_table']} + move_uploaded_file($_FILES['mb_icon']['tmp_name'], $dest_path); + chmod($dest_path, G5_FILE_PERMISSION); + + if (file_exists($dest_path)) { + $size = getimagesize($dest_path); + // 아이콘의 폭 또는 높이가 설정값 보다 크다면 이미 업로드 된 아이콘 삭제 + if ($size[0] > $config['cf_member_icon_width'] || $size[1] > $config['cf_member_icon_height']) { + @unlink($dest_path); + } + } + } + } + + if ($mb_password) + $sql_password = " , mb_password = '" . get_encrypt_string($mb_password) . "' "; + else + $sql_password = ""; + + if ($passive_certify) + $sql_certify = " , mb_email_certify = '" . G5_TIME_YMDHIS . "' "; + else + $sql_certify = ""; + + $sql = " update {$g5['member_table']} set {$sql_common} {$sql_password} {$sql_certify} where mb_id = '{$mb_id}' "; - sql_query($sql); -} -else - alert('제대로 된 값이 넘어오지 않았습니다.'); + sql_query($sql); +} else + alert('제대로 된 값이 넘어오지 않았습니다.'); -goto_url('./member_form.php?'.$qstr.'&w=u&mb_id='.$mb_id, false); -?> \ No newline at end of file +goto_url('./member_form.php?' . $qstr . '&w=u&mb_id=' . $mb_id); diff --git a/AvocadoEdition_Light/adm/member_list.php b/AvocadoEdition_Light/adm/member_list.php index 68800b4..1e0a0ed 100644 --- a/AvocadoEdition_Light/adm/member_list.php +++ b/AvocadoEdition_Light/adm/member_list.php @@ -8,31 +8,31 @@ $sql_common = " from {$g5['member_table']} "; $sql_search = " where (1) "; if ($stx) { - $sql_search .= " and ( "; - switch ($sfl) { - case 'mb_point' : - $sql_search .= " ({$sfl} >= '{$stx}') "; - break; - case 'mb_level' : - $sql_search .= " ({$sfl} = '{$stx}') "; - break; - case 'mb_tel' : - case 'mb_hp' : - $sql_search .= " ({$sfl} like '%{$stx}') "; - break; - default : - $sql_search .= " ({$sfl} like '{$stx}%') "; - break; - } - $sql_search .= " ) "; + $sql_search .= " and ( "; + switch ($sfl) { + case 'mb_point': + $sql_search .= " ({$sfl} >= '{$stx}') "; + break; + case 'mb_level': + $sql_search .= " ({$sfl} = '{$stx}') "; + break; + case 'mb_tel': + case 'mb_hp': + $sql_search .= " ({$sfl} like '%{$stx}') "; + break; + default: + $sql_search .= " ({$sfl} like '{$stx}%') "; + break; + } + $sql_search .= " ) "; } if ($is_admin != 'super') - $sql_search .= " and mb_level <= '{$member['mb_level']}' "; + $sql_search .= " and mb_level <= '{$member['mb_level']}' "; if (!$sst) { - $sst = "mb_datetime"; - $sod = "desc"; + $sst = "mb_datetime"; + $sod = "desc"; } $sql_order = " order by {$sst} {$sod} "; @@ -42,8 +42,9 @@ $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) + $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 // 탈퇴회원수 @@ -56,7 +57,7 @@ $sql = " select count(*) as cnt {$sql_common} {$sql_search} and mb_intercept_dat $row = sql_fetch($sql); $intercept_count = $row['cnt']; -$listall = '전체목록'; +$listall = '전체목록'; $g5['title'] = '회원관리'; include_once('./admin.head.php'); @@ -68,160 +69,164 @@ $colspan = 10; ?>
    - - 총회원수 명 중, - 차단 명, - 탈퇴 명 + + 총회원수 명 중, + 차단 + 명, + 탈퇴 +
    -

    - 회원자료 삭제 시 다른 회원이 기존 회원아이디를 사용하지 못하도록 회원아이디, 이름, 닉네임은 삭제하지 않고 영구 보관합니다. -

    +

    + 회원자료 삭제 시 다른 회원이 기존 회원아이디를 사용하지 못하도록 회원아이디, 이름, 닉네임은 삭제하지 않고 영구 보관합니다. +

    - - - - - + + + + +

    -
    - - - - - - + + + + + + + -
    - - - - - - - - - - - - - - - - +
    목록
    - - 아이디이름상태권한가입일최종접속관리
    + + + + + + + + + + + + + + + 수정'; - $leave_date = $row['mb_leave_date'] ? $row['mb_leave_date'] : date('Ymd', G5_SERVER_TIME); - $intercept_date = $row['mb_intercept_date'] ? $row['mb_intercept_date'] : date('Ymd', G5_SERVER_TIME); - $mb_nick = get_sideview($row['mb_id'], get_text($row['mb_nick']), $row['mb_email'], $row['mb_homepage']); - $mb_id = $row['mb_id']; - $leave_msg = ''; - $intercept_msg = ''; - $intercept_title = ''; - if ($row['mb_leave_date']) { - $mb_id = $mb_id; - $leave_msg = '탈퇴함'; - } - else if ($row['mb_intercept_date']) { - $mb_id = $mb_id; - $intercept_msg = '차단됨'; - $intercept_title = '차단해제'; - } - if ($intercept_title == '') - $intercept_title = '차단하기'; - $bg = 'bg'.($i%2); - ?> + $s_mod = '수정'; + $leave_date = $row['mb_leave_date'] ? $row['mb_leave_date'] : date('Ymd', G5_SERVER_TIME); + $intercept_date = $row['mb_intercept_date'] ? $row['mb_intercept_date'] : date('Ymd', G5_SERVER_TIME); + $mb_nick = get_sideview($row['mb_id'], get_text($row['mb_nick']), $row['mb_email'], $row['mb_homepage']); + $mb_id = $row['mb_id']; + $leave_msg = ''; + $intercept_msg = ''; + $intercept_title = ''; + if ($row['mb_leave_date']) { + $mb_id = $mb_id; + $leave_msg = '탈퇴함'; + } else if ($row['mb_intercept_date']) { + $mb_id = $mb_id; + $intercept_msg = '차단됨'; + $intercept_title = '차단해제'; + } + if ($intercept_title == '') + $intercept_title = '차단하기'; + $bg = 'bg' . ($i % 2); + ?> - - + + - - - - - - - - + + + + + + + + - "; - ?> - -
    목록
    + + 아이디이름상태권한가입일최종접속관리
    - - -
    + + + - - - -
    + + + +
    자료가 없습니다.
    -
    + 자료가 없습니다."; + ?> + + + -
    -
    - build - -
    -
    - delete - -
    - - add - -
    +
    +
    + build + +
    +
    + delete + +
    + + add + +
    - + diff --git a/AvocadoEdition_Light/adm/member_list_delete.php b/AvocadoEdition_Light/adm/member_list_delete.php index f416a60..852719b 100644 --- a/AvocadoEdition_Light/adm/member_list_delete.php +++ b/AvocadoEdition_Light/adm/member_list_delete.php @@ -9,29 +9,27 @@ auth_check($auth[$sub_menu], "d"); check_admin_token(); $msg = ""; -for ($i=0; $i= $member['mb_level']) { - $msg .= "{$mb['mb_id']} : 자신보다 권한이 높거나 같은 회원은 삭제할 수 없습니다.\\n"; - } else { - // 회원자료 삭제 - member_delete($mb['mb_id']); - } + if (!$mb['mb_id']) { + $msg .= "{$mb['mb_id']} : 회원자료가 존재하지 않습니다.\\n"; + } else if ($member['mb_id'] == $mb['mb_id']) { + $msg .= "{$mb['mb_id']} : 로그인 중인 관리자는 삭제 할 수 없습니다.\\n"; + } else if (is_admin($mb['mb_id']) == "super") { + $msg .= "{$mb['mb_id']} : 최고 관리자는 삭제할 수 없습니다.\\n"; + } else if ($is_admin != "super" && $mb['mb_level'] >= $member['mb_level']) { + $msg .= "{$mb['mb_id']} : 자신보다 권한이 높거나 같은 회원은 삭제할 수 없습니다.\\n"; + } else { + // 회원자료 삭제 + member_delete($mb['mb_id']); + } } if ($msg) - echo ""; + echo ""; goto_url("./member_list.php?$qstr"); -?> diff --git a/AvocadoEdition_Light/adm/member_list_update.php b/AvocadoEdition_Light/adm/member_list_update.php index d4caa4c..ee9d474 100644 --- a/AvocadoEdition_Light/adm/member_list_update.php +++ b/AvocadoEdition_Light/adm/member_list_update.php @@ -5,88 +5,84 @@ include_once('./_common.php'); check_demo(); if (!count($_POST['chk'])) { - alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요."); + alert($_POST['act_button'] . " 하실 항목을 하나 이상 체크하세요."); } auth_check($auth[$sub_menu], 'w'); if ($_POST['act_button'] == "선택수정") { - for ($i=0; $i= $member['mb_level']) { - $msg .= $mb['mb_id'].' : 자신보다 권한이 높거나 같은 회원은 수정할 수 없습니다.\\n'; - } else if ($member['mb_id'] == $mb['mb_id']) { - $msg .= $mb['mb_id'].' : 로그인 중인 관리자는 수정 할 수 없습니다.\\n'; - } else { - if($_POST['mb_certify'][$k]) - $mb_adult = $_POST['mb_adult'][$k]; - else - $mb_adult = 0; + if (!$mb['mb_id']) { + $msg .= $mb['mb_id'] . ' : 회원자료가 존재하지 않습니다.\\n'; + } else if ($is_admin != 'super' && $mb['mb_level'] >= $member['mb_level']) { + $msg .= $mb['mb_id'] . ' : 자신보다 권한이 높거나 같은 회원은 수정할 수 없습니다.\\n'; + } else if ($member['mb_id'] == $mb['mb_id']) { + $msg .= $mb['mb_id'] . ' : 로그인 중인 관리자는 수정 할 수 없습니다.\\n'; + } else { + if ($_POST['mb_certify'][$k]) + $mb_adult = $_POST['mb_adult'][$k]; + else + $mb_adult = 0; - $sql = " update {$g5['member_table']} + $sql = " update {$g5['member_table']} set mb_level = '{$_POST['mb_level'][$k]}' where mb_id = '{$_POST['mb_id'][$k]}' "; - sql_query($sql); - } + sql_query($sql); } + } } else if ($_POST['act_button'] == "선택삭제") { - for ($i=0; $i= $member['mb_level']) { - $msg .= $mb['mb_id'].' : 자신보다 권한이 높거나 같은 회원은 삭제할 수 없습니다.\\n'; - } else { - // 회원자료 삭제 - member_delete($mb['mb_id']); - } + if (!$mb['mb_id']) { + $msg .= $mb['mb_id'] . ' : 회원자료가 존재하지 않습니다.\\n'; + } else if ($member['mb_id'] == $mb['mb_id']) { + $msg .= $mb['mb_id'] . ' : 로그인 중인 관리자는 삭제 할 수 없습니다.\\n'; + } else if (is_admin($mb['mb_id']) == 'super') { + $msg .= $mb['mb_id'] . ' : 최고 관리자는 삭제할 수 없습니다.\\n'; + } else if ($is_admin != 'super' && $mb['mb_level'] >= $member['mb_level']) { + $msg .= $mb['mb_id'] . ' : 자신보다 권한이 높거나 같은 회원은 삭제할 수 없습니다.\\n'; + } else { + // 회원자료 삭제 + member_delete($mb['mb_id']); } -}else if ($_POST['act_button'] == "완전삭제") { + } +} else if ($_POST['act_button'] == "완전삭제") { - for ($i=0; $i= $member['mb_level']) { - $msg .= $mb['mb_id'].' : 자신보다 권한이 높거나 같은 회원은 삭제할 수 없습니다.\\n'; - } else { - // 회원자료 삭제 - sql_query(" delete from {$g5['member_table']} where mb_id = '{$_POST['mb_id'][$k]}' "); - } + if (!$mb['mb_id']) { + $msg .= $mb['mb_id'] . ' : 회원자료가 존재하지 않습니다.\\n'; + } else if ($member['mb_id'] == $mb['mb_id']) { + $msg .= $mb['mb_id'] . ' : 로그인 중인 관리자는 삭제 할 수 없습니다.\\n'; + } else if (is_admin($mb['mb_id']) == 'super') { + $msg .= $mb['mb_id'] . ' : 최고 관리자는 삭제할 수 없습니다.\\n'; + } else if ($is_admin != 'super' && $mb['mb_level'] >= $member['mb_level']) { + $msg .= $mb['mb_id'] . ' : 자신보다 권한이 높거나 같은 회원은 삭제할 수 없습니다.\\n'; + } else { + // 회원자료 삭제 + sql_query(" delete from {$g5['member_table']} where mb_id = '{$_POST['mb_id'][$k]}' "); } + } } if ($msg) - //echo ''; - alert($msg); + //echo ''; + alert($msg); -goto_url('./member_list.php?'.$qstr); -?> +goto_url('./member_list.php?' . $qstr); diff --git a/AvocadoEdition_Light/adm/menu_form.php b/AvocadoEdition_Light/adm/menu_form.php index f933a65..5885d28 100644 --- a/AvocadoEdition_Light/adm/menu_form.php +++ b/AvocadoEdition_Light/adm/menu_form.php @@ -3,141 +3,142 @@ $sub_menu = "100400"; include_once('./_common.php'); if ($is_admin != 'super') - alert_close('최고관리자만 접근 가능합니다.'); + alert_close('최고관리자만 접근 가능합니다.'); $g5['title'] = '메뉴 추가'; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); // 코드 -if($new == 'new' || !$code) { - $code = base_convert(substr($code,0, 2), 36, 10); - $code += 36; - $code = base_convert($code, 10, 36); +if ($new == 'new' || !$code) { + $code = base_convert(substr($code, 0, 2), 36, 10); + $code += 36; + $code = base_convert($code, 10, 36); } ?> \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); +?> diff --git a/AvocadoEdition_Light/adm/menu_form_search.php b/AvocadoEdition_Light/adm/menu_form_search.php index 8b4a018..693c93f 100644 --- a/AvocadoEdition_Light/adm/menu_form_search.php +++ b/AvocadoEdition_Light/adm/menu_form_search.php @@ -2,110 +2,111 @@ include_once('./_common.php'); if ($is_admin != 'super') - die('최고관리자만 접근 가능합니다.'); + die('최고관리자만 접근 가능합니다.'); -switch($type) { - case 'group': - $sql = " select gr_id as id, gr_subject as subject +switch ($type) { + case 'group': + $sql = " select gr_id as id, gr_subject as subject from {$g5['group_table']} order by gr_order, gr_id "; - break; - case 'board': - $sql = " select bo_table as id, bo_subject as subject + break; + case 'board': + $sql = " select bo_table as id, bo_subject as subject from {$g5['board_table']} order by bo_order, bo_table "; - break; - case 'content': - $sql = " select co_id as id, co_subject as subject + break; + case 'content': + $sql = " select co_id as id, co_subject as subject from {$g5['content_table']} order by co_id "; - break; - default: - $sql = ''; - break; + break; + default: + $sql = ''; + break; } ?> + for ($i = 0; $row = sql_fetch_array($result); $i++) { + if ($i == 0) { + ?> -
    - - - - - - - - +
    +
    제목선택
    + + + + + + + - + - - - - + + + + - + - -
    제목선택
    - "> - - -
    + "> + + +
    -
    + + + -
    +
    -
    +
    -
    +
    - + - - - - - - - - - + + + + + + + - - + + +
    + +
    -
    -
    +
    -
    +
    -
    - \ No newline at end of file +
    + diff --git a/AvocadoEdition_Light/adm/menu_list.php b/AvocadoEdition_Light/adm/menu_list.php index 6d96cb8..04c3ab1 100644 --- a/AvocadoEdition_Light/adm/menu_list.php +++ b/AvocadoEdition_Light/adm/menu_list.php @@ -2,7 +2,8 @@ $sub_menu = "100400"; include_once('./_common.php'); -if ($is_admin != 'super') alert('최고관리자만 접근 가능합니다.'); +if ($is_admin != 'super') + alert('최고관리자만 접근 가능합니다.'); $sql = " select * from {$g5['menu_table']} order by me_order*1, me_id "; @@ -14,177 +15,182 @@ $colspan = 8; ?>
    -

    주의! 메뉴설정 작업 후 반드시 확인을 누르셔야 저장됩니다.

    +

    주의! 메뉴설정 작업 후 반드시 확인을 누르셔야 저장됩니다.

    -

    아이콘 항목에 사용할 구글 아이콘 이름을 입력해주세요. ( ex. <span class="material-icons">home</span>home 만 입력하기 )

    +

    아이콘 항목에 사용할 구글 아이콘 이름을 입력해주세요. ( ex. <span + class="material-icons">home</span>home 만 입력하기 )

    -
    - + + -
    - app_registration - -
    - save - -
    -
    +
    + app_registration + +
    + save + +
    +
    - + + > + + + + + + 자료가 없습니다.'; + ?> + + +
    diff --git a/AvocadoEdition_Light/adm/menu_list_update.php b/AvocadoEdition_Light/adm/menu_list_update.php index 97d1a78..b008e15 100644 --- a/AvocadoEdition_Light/adm/menu_list_update.php +++ b/AvocadoEdition_Light/adm/menu_list_update.php @@ -5,7 +5,7 @@ include_once('./_common.php'); check_demo(); if ($is_admin != 'super') - alert('최고관리자만 접근 가능합니다.'); + alert('최고관리자만 접근 가능합니다.'); check_admin_token(); @@ -17,45 +17,45 @@ $group_code = null; $primary_code = null; $count = count($_POST['code']); -for ($i=0; $i<$count; $i++) { +for ($i = 0; $i < $count; $i++) { - $_POST = array_map_deep('trim', $_POST); + $_POST = array_map_deep('trim', $_POST); - $code = $_POST['code'][$i]; - $me_name = $_POST['me_name'][$i]; - $me_link = $_POST['me_link'][$i]; + $code = $_POST['code'][$i]; + $me_name = $_POST['me_name'][$i]; + $me_link = $_POST['me_link'][$i]; - if(!$code || !$me_name) - continue; + if (!$code || !$me_name) + continue; - $sub_code = ''; - if($group_code == $code) { - $sql = " select MAX(SUBSTRING(me_code,3,2)) as max_me_code + $sub_code = ''; + if ($group_code == $code) { + $sql = " select MAX(SUBSTRING(me_code,3,2)) as max_me_code from {$g5['menu_table']} where SUBSTRING(me_code,1,2) = '$primary_code' "; - $row = sql_fetch($sql); + $row = sql_fetch($sql); - $sub_code = base_convert($row['max_me_code'], 36, 10); - $sub_code += 36; - $sub_code = base_convert($sub_code, 10, 36); + $sub_code = base_convert($row['max_me_code'], 36, 10); + $sub_code += 36; + $sub_code = base_convert($sub_code, 10, 36); - $me_code = $primary_code.$sub_code; - } else { - $sql = " select MAX(SUBSTRING(me_code,1,2)) as max_me_code + $me_code = $primary_code . $sub_code; + } else { + $sql = " select MAX(SUBSTRING(me_code,1,2)) as max_me_code from {$g5['menu_table']} where LENGTH(me_code) = '2' "; - $row = sql_fetch($sql); + $row = sql_fetch($sql); - $me_code = base_convert($row['max_me_code'], 36, 10); - $me_code += 36; - $me_code = base_convert($me_code, 10, 36); + $me_code = base_convert($row['max_me_code'], 36, 10); + $me_code += 36; + $me_code = base_convert($me_code, 10, 36); - $group_code = $code; - $primary_code = $me_code; - } + $group_code = $code; + $primary_code = $me_code; + } - // 메뉴 등록 - $sql = " insert into {$g5['menu_table']} + // 메뉴 등록 + $sql = " insert into {$g5['menu_table']} set me_code = '{$me_code}', me_icon = '{$_POST['me_icon'][$i]}', me_name = '{$me_name}', @@ -63,8 +63,7 @@ for ($i=0; $i<$count; $i++) { me_target = '{$_POST['me_target'][$i]}', me_order = '{$_POST['me_order'][$i]}', me_use = '{$_POST['me_use'][$i]}' "; - sql_query($sql); + sql_query($sql); } goto_url('./menu_list.php'); -?> diff --git a/AvocadoEdition_Light/adm/phpinfo.php b/AvocadoEdition_Light/adm/phpinfo.php index a7f01a1..c1e7386 100644 --- a/AvocadoEdition_Light/adm/phpinfo.php +++ b/AvocadoEdition_Light/adm/phpinfo.php @@ -3,8 +3,5 @@ $sub_menu = "100500"; include_once('./_common.php'); check_demo(); - auth_check($auth[$sub_menu], 'r'); - phpinfo(); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/adm/session_file_delete.php b/AvocadoEdition_Light/adm/session_file_delete.php index 895c761..17cdd62 100644 --- a/AvocadoEdition_Light/adm/session_file_delete.php +++ b/AvocadoEdition_Light/adm/session_file_delete.php @@ -1,59 +1,61 @@
    -

    - 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. -

    +

    + 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. +

    - 세션 디렉토리를 열지못했습니다.

    "; +} else { + $list_tag_st = "
      \n
    • 완료됨
    • \n"; + $list_tag_end = "
    \n"; +} + +$cnt = 0; +echo $list_tag_st; +while ($file = readdir($dir)) { + + if (!strstr($file, 'sess_')) + continue; + if (strpos($file, 'sess_') != 0) + continue; + + $session_file = G5_DATA_PATH . '/session/' . $file; + + if (!$atime = @fileatime($session_file)) { + continue; + } + if (time() > $atime + (3600 * 6)) { // 지난시간을 초로 계산해서 적어주시면 됩니다. default : 6시간전 + $cnt++; + $return = unlink($session_file); + //echo "\n"; + echo "
  • {$session_file}
  • \n"; + flush(); - $list_tag_st = ""; - $list_tag_end = ""; - if (!$dir=@opendir(G5_DATA_PATH.'/session')) { - echo "

    세션 디렉토리를 열지못했습니다.

    "; - } else { - $list_tag_st = "
      \n
    • 완료됨
    • \n"; - $list_tag_end = "
    \n"; - } - - $cnt=0; - echo $list_tag_st; - while($file=readdir($dir)) { - - if (!strstr($file,'sess_')) continue; - if (strpos($file,'sess_')!=0) continue; - - $session_file = G5_DATA_PATH.'/session/'.$file; - - if (!$atime=@fileatime($session_file)) { - continue; - } - if (time() > $atime + (3600 * 6)) { // 지난시간을 초로 계산해서 적어주시면 됩니다. default : 6시간전 - $cnt++; - $return = unlink($session_file); - //echo "\n"; - echo "
  • {$session_file}
  • \n"; - - flush(); - - if ($cnt%10==0) - //echo "\n"; - echo "\n"; - } - } - echo $list_tag_end; - echo '

    세션데이터 '.$cnt.'건 삭제 완료됐습니다.
    프로그램의 실행을 끝마치셔도 좋습니다.

    '.PHP_EOL; + if ($cnt % 10 == 0) + //echo "\n"; + echo "\n"; + } +} +echo $list_tag_end; +echo '

    세션데이터 ' . $cnt . '건 삭제 완료됐습니다.
    프로그램의 실행을 끝마치셔도 좋습니다.

    ' . PHP_EOL; ?>
    -

    - 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. -

    +

    + 완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오. +

    썸네일디렉토리를 열지못했습니다.

    '; + echo '

    썸네일디렉토리를 열지못했습니다.

    '; } -$cnt=0; -echo '
      '.PHP_EOL; +$cnt = 0; +echo '
        ' . PHP_EOL; -foreach($directory as $dir) { - $files = glob($dir.'/thumb-*'); - if (is_array($files)) { - foreach($files as $thumbnail) { - $cnt++; - @unlink($thumbnail); +foreach ($directory as $dir) { + $files = glob($dir . '/thumb-*'); + if (is_array($files)) { + foreach ($files as $thumbnail) { + $cnt++; + @unlink($thumbnail); - echo '
      • '.$thumbnail.'
      • '.PHP_EOL; + echo '
      • ' . $thumbnail . '
      • ' . PHP_EOL; - flush(); + flush(); - if ($cnt%10==0) - echo PHP_EOL; - } + if ($cnt % 10 == 0) + echo PHP_EOL; } + } } -echo '
      • 완료됨
      '.PHP_EOL; -echo '

      썸네일 '.$cnt.'건의 삭제 완료됐습니다.
      프로그램의 실행을 끝마치셔도 좋습니다.

      '.PHP_EOL; +echo '
    • 완료됨
    ' . PHP_EOL; +echo '

    썸네일 ' . $cnt . '건의 삭제 완료됐습니다.
    프로그램의 실행을 끝마치셔도 좋습니다.

    ' . PHP_EOL; ?> \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/adm/viewer_form.php b/AvocadoEdition_Light/adm/viewer_form.php index ce3a2d8..8b89d01 100644 --- a/AvocadoEdition_Light/adm/viewer_form.php +++ b/AvocadoEdition_Light/adm/viewer_form.php @@ -6,10 +6,10 @@ include_once(G5_EDITOR_LIB); auth_check($auth[$sub_menu], 'r'); if ($is_admin != 'super') - alert('최고관리자만 접근 가능합니다.'); + alert('최고관리자만 접근 가능합니다.'); $g5['title'] = '메인 편집'; -include_once ('./admin.head.php'); +include_once('./admin.head.php'); // -- 내용관리의 기능을 통해 메뉴와 메인 내용을 가져온다. // -- 메인 정보 가져오기 @@ -20,45 +20,44 @@ $main_co = sql_fetch($sql); ?> -
    - -
    -
    - save - -
    -
    + + +
    +
    + save + +
    +
    -
    - - - - - - - - +
    +
    - - -
    + + + + + + + - -
    + + +
    -
    + + +
    - diff --git a/AvocadoEdition_Light/adm/viewer_form_update.php b/AvocadoEdition_Light/adm/viewer_form_update.php index 584199c..710fadc 100644 --- a/AvocadoEdition_Light/adm/viewer_form_update.php +++ b/AvocadoEdition_Light/adm/viewer_form_update.php @@ -8,22 +8,20 @@ $sql_common = " co_html = '1', // -- 메인 정보 가져오기 $sql = " select co_id from {$g5['content_table']} where co_id = 'site_main' "; $main_co = sql_fetch($sql); -if(!$main_co['co_id']) { - // Insert - $sql = " insert {$g5['content_table']} +if (!$main_co['co_id']) { + // Insert + $sql = " insert {$g5['content_table']} set co_id = 'site_main', co_content = '{$main_content}', {$sql_common} "; - sql_query($sql); + sql_query($sql); } else { - // Update - $sql = " update {$g5['content_table']} + // Update + $sql = " update {$g5['content_table']} set co_content = '{$main_content}', {$sql_common} where co_id = 'site_main' "; - sql_query($sql); + sql_query($sql); } - -goto_url('./viewer_form.php', false); -?> \ No newline at end of file +goto_url('./viewer_form.php'); diff --git a/AvocadoEdition_Light/adm/visit.sub.php b/AvocadoEdition_Light/adm/visit.sub.php index ae4a4f7..d32c97e 100644 --- a/AvocadoEdition_Light/adm/visit.sub.php +++ b/AvocadoEdition_Light/adm/visit.sub.php @@ -1,57 +1,71 @@
    -
    - 기간별검색   - - - ~ - - - -
    +
    + 기간별검색   + + + ~ + + + +

    diff --git a/AvocadoEdition_Light/adm/visit_browser.php b/AvocadoEdition_Light/adm/visit_browser.php index aca6850..19924e0 100644 --- a/AvocadoEdition_Light/adm/visit_browser.php +++ b/AvocadoEdition_Light/adm/visit_browser.php @@ -14,82 +14,83 @@ $sum_count = 0; $sql = " select * from {$g5['visit_table']} where vi_date between '{$fr_date}' and '{$to_date}' "; $result = sql_query($sql); -while ($row=sql_fetch_array($result)) { - $s = $row['vi_browser']; - if(!$s) - $s = get_brow($row['vi_agent']); +while ($row = sql_fetch_array($result)) { + $s = $row['vi_browser']; + if (!$s) + $s = get_brow($row['vi_agent']); - $arr[$s]++; + $arr[$s]++; - if ($arr[$s] > $max) $max = $arr[$s]; + if ($arr[$s] > $max) + $max = $arr[$s]; - $sum_count++; + $sum_count++; } ?>
    - +
    - + - + - + - + - $value) { - $count = $arr[$key]; - if ($save_count != $count) { - $i++; - $no = $i; - $save_count = $count; - } else { - $no = ""; - } + foreach ($arr as $key => $value) { + $count = $arr[$key]; + if ($save_count != $count) { + $i++; + $no = $i; + $save_count = $count; + } else { + $no = ""; + } - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - - + + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    순위 브라우저 그래프 접속자수 비율(%)
    합계 100%
    -
    +
    +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    $max) $max = $row['cnt']; + if ($row['cnt'] > $max) + $max = $row['cnt']; - $sum_count += $row['cnt']; + $sum_count += $row['cnt']; } ?>
    - +
    - + - + - + - + - $value) { - $count = $value; + $value) { + $count = $value; - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    년-월-일 그래프 접속자수 비율(%)
    합계 100%
    -
    +
    + +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    - 접속자 로그를 삭제할 년도와 방법을 선택해주십시오. + 접속자 로그를 삭제할 년도와 방법을 선택해주십시오.
    -
    + -
    - - - - - - - - - - + + + + + + + + + + +
    일자선택 - 년 -     - 월 +
    + + + + + + + + + + - - - - - - - - - - -
    일자선택 + 년 +     + 월 -
    삭제방법선택 - -
    관리자 비밀번호 - -
    -
    +
    삭제방법선택 + +
    관리자 비밀번호 + +
    +
    -
    -
    - save - -
    -
    +
    +
    + save + +
    +
    \ No newline at end of file +alert('총 ' . number_format($total_count) . '건 중 ' . number_format($total_count - $total_count2) . '건 삭제 완료', './visit_delete.php'); +?> diff --git a/AvocadoEdition_Light/adm/visit_device.php b/AvocadoEdition_Light/adm/visit_device.php index ec35059..e3246bd 100644 --- a/AvocadoEdition_Light/adm/visit_device.php +++ b/AvocadoEdition_Light/adm/visit_device.php @@ -14,86 +14,87 @@ $sum_count = 0; $sql = " select * from {$g5['visit_table']} where vi_date between '{$fr_date}' and '{$to_date}' "; $result = sql_query($sql); -while ($row=sql_fetch_array($result)) { - $s = $row['vi_device']; - if(!$s) - $s = '기타'; +while ($row = sql_fetch_array($result)) { + $s = $row['vi_device']; + if (!$s) + $s = '기타'; - $arr[$s]++; + $arr[$s]++; - if ($arr[$s] > $max) $max = $arr[$s]; + if ($arr[$s] > $max) + $max = $arr[$s]; - $sum_count++; + $sum_count++; } ?>
    - +
    - + - + - + - + - $value) { - $count = $arr[$key]; - if ($save_count != $count) { - $i++; - $no = $i; - $save_count = $count; - } else { - $no = ''; - } + foreach ($arr as $key => $value) { + $count = $arr[$key]; + if ($save_count != $count) { + $i++; + $no = $i; + $save_count = $count; + } else { + $no = ''; + } - if (!$key) { - $key = '기타'; - } + if (!$key) { + $key = '기타'; + } - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - - + + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    순위 접속기기 그래프 접속자수 비율(%)
    합계 100%
    -
    +
    +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    $max) $max = $arr[$s]; + if ($arr[$s] > $max) + $max = $arr[$s]; - $sum_count++; + $sum_count++; } ?>
    - +
    - + - + - + - + - $value) { - $count = $arr[$key]; - if ($save_count != $count) { - $i++; - $no = $i; - $save_count = $count; - } else { - $no = ''; - } + foreach ($arr as $key => $value) { + $count = $arr[$key]; + if ($save_count != $count) { + $i++; + $no = $i; + $save_count = $count; + } else { + $no = ''; + } - if (!$key) { - $link = ''; - $link2 = ''; - $key = '직접'; - } else { - $link = ''; - $link2 = ''; - } + if (!$key) { + $link = ''; + $link2 = ''; + $key = '직접'; + } else { + $link = ''; + $link2 = ''; + } - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> - - - - + + + - - - - + + + + + '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    순위 접속 도메인 그래프 접속자수 비율(%)
    합계 100%
    -
    + $bg = 'bg' . ($i % 2); + ?> +
    +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    $max) $max = $row['cnt']; + if ($row['cnt'] > $max) + $max = $row['cnt']; - $sum_count += $row['cnt']; + $sum_count += $row['cnt']; } ?>
    - +
    - + - + - + - + - - - - + + - - - - + + + + + '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    시간 그래프 접속자수 비율(%)
    합계 100%
    -
    + $bg = 'bg' . ($i % 2); + ?> +
    +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    - +
    - + - + - ', '&'), array("<", ">", "&"), $referer); - $link = ''; - $link = str_replace('&', "&", $link); - $link2 = ''; + $title = str_replace(array('<', '>', '&'), array("<", ">", "&"), $referer); + $link = ''; + $link = str_replace('&', "&", $link); + $link2 = ''; } if ($is_admin == 'super') - $ip = $row['vi_ip']; + $ip = $row['vi_ip']; else - $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['vi_ip']); + $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['vi_ip']); - if ($brow == '기타') { $brow = ''.$brow.''; } - if ($os == '기타') { $os = ''.$os.''; } + if ($brow == '기타') { + $brow = '' . $brow . ''; + } + if ($os == '기타') { + $os = '' . $os . ''; + } - $bg = 'bg'.($i%2); - ?> - - - - - - - - + $bg = 'bg' . ($i % 2); + ?> + + + + + + + + - '; - ?> + '; + ?> -
    목록
    IP 접속 경로 브라우저 OS 접속기기 일시
    자료가 없거나 관리자에 의해 삭제되었습니다.
    자료가 없거나 관리자에 의해 삭제되었습니다.
    +
    $max) $max = $row['cnt']; + if ($row['cnt'] > $max) + $max = $row['cnt']; - $sum_count += $row['cnt']; + $sum_count += $row['cnt']; } ?>
    - +
    - + - + - + - + - $value) { - $count = $value; + $value) { + $count = $value; - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    년-월 그래프 접속자수 비율(%)
    합계 100%
    -
    +
    + +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    $max) $max = $arr[$s]; + if ($arr[$s] > $max) + $max = $arr[$s]; - $sum_count++; + $sum_count++; } ?>
    - +
    - + - + - + - + - $value) { - $count = $arr[$key]; - if ($save_count != $count) { - $i++; - $no = $i; - $save_count = $count; - } else { - $no = ''; - } + foreach ($arr as $key => $value) { + $count = $arr[$key]; + if ($save_count != $count) { + $i++; + $no = $i; + $save_count = $count; + } else { + $no = ''; + } - if (!$key) { - $key = 'Unknown'; - } + if (!$key) { + $key = 'Unknown'; + } - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - - + + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    순위 OS 그래프 접속자수 비율(%)
    합계 100%
    -
    +
    +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    처음'; //페이지 처음으로 (초기화용도) +$listall = '처음'; //페이지 처음으로 (초기화용도) ?>
    -
    - + + -
    +
    - +
    - + - + - 처음'; //페이지 처 $title = ""; if ($row['vi_referer']) { - $referer = get_text(cut_str($row['vi_referer'], 255, "")); - $referer = urldecode($referer); + $referer = get_text(cut_str($row['vi_referer'], 255, "")); + $referer = urldecode($referer); - if (!is_utf8($referer)) { - $referer = iconv('euc-kr', 'utf-8', $referer); - } + if (!is_utf8($referer)) { + $referer = iconv('euc-kr', 'utf-8', $referer); + } - $title = str_replace(array("<", ">"), array("<", ">"), $referer); - $link = ''; + $title = str_replace(array("<", ">"), array("<", ">"), $referer); + $link = ''; } if ($is_admin == 'super') - $ip = $row['vi_ip']; + $ip = $row['vi_ip']; else - $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['vi_ip']); + $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['vi_ip']); - $bg = 'bg'.($i%2); - ?> - - - - - - - - - - '; ?> + $bg = 'bg' . ($i % 2); + ?> + + + + + + + + + + '; ?> -
    IP 접속 경로 브라우저 OS 접속기기 일시
    자료가 없습니다.
    + +
    자료가 없습니다.
    +
    - +
    - + - + - + - + - + $bg = 'bg' . ($i % 2); + ?> - - - + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    요일 그래프 접속자수 비율(%)
    합계 100%
    -
    +
    +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    $max) $max = $row['cnt']; + if ($row['cnt'] > $max) + $max = $row['cnt']; - $sum_count += $row['cnt']; + $sum_count += $row['cnt']; } ?>
    - +
    - + - + - + - + - $value) { - $count = $value; + $value) { + $count = $value; - $rate = ($count / $sum_count * 100); - $s_rate = number_format($rate, 1); + $rate = ($count / $sum_count * 100); + $s_rate = number_format($rate, 1); - $bg = 'bg'.($i%2); - ?> + $bg = 'bg' . ($i % 2); + ?> - - - + + - - - + + + + + - '; - } - ?> + } else { + echo ''; + } + ?> -
    목록
    그래프 접속자수 비율(%)
    합계 100%
    -
    +
    + +
    -
    -
    자료가 없습니다.
    자료가 없습니다.
    +
    ', 0); -add_javascript('', 0); -add_javascript('', 0); -add_javascript('', 0); -add_javascript('', 0); -add_javascript('', 0); +add_stylesheet('', 0); +add_javascript('', 0); +add_javascript('', 0); +add_javascript('', 0); +add_javascript('', 0); +add_javascript('', 0); if (!($graph == 'line' || $graph == 'bar')) - $graph = 'line'; + $graph = 'line'; if ($graph == 'bar') { - // 바 타입으로 사용하는 코드입니다. - add_javascript('', 0); - add_javascript('', 0); - add_javascript('', 0); + // 바 타입으로 사용하는 코드입니다. + add_javascript('', 0); + add_javascript('', 0); + add_javascript('', 0); } $g5['title'] = '글,댓글 현황'; -include_once ('./admin.head.php'); +include_once('./admin.head.php'); $period_array = array( - '오늘'=>array('시간', 0), - '어제'=>array('시간', 0), - '7일전'=>array('일', 7), - '14일전'=>array('일', 14), - '30일전'=>array('일', 30), - '3개월전'=>array('주', 90), - '6개월전'=>array('주', 180), - '1년전'=>array('월', 365), - '2년전'=>array('월', 365*2), - '3년전'=>array('월', 365*3), - '5년전'=>array('년', 365*5), - '10년전'=>array('년', 365*10), + '오늘' => array('시간', 0), + '어제' => array('시간', 0), + '7일전' => array('일', 7), + '14일전' => array('일', 14), + '30일전' => array('일', 30), + '3개월전' => array('주', 90), + '6개월전' => array('주', 180), + '1년전' => array('월', 365), + '2년전' => array('월', 365 * 2), + '3년전' => array('월', 365 * 3), + '5년전' => array('년', 365 * 5), + '10년전' => array('년', 365 * 10), ); $is_period = false; -foreach($period_array as $key=>$value) { - if ($key == $period) { - $is_period = true; - break; - } +foreach ($period_array as $key => $value) { + if ($key == $period) { + $is_period = true; + break; + } } if (!$is_period) - $period = '오늘'; + $period = '오늘'; $day = $period_array[$period][0]; @@ -58,153 +58,151 @@ $today = date('Y-m-d', G5_SERVER_TIME); $yesterday = date('Y-m-d', G5_SERVER_TIME - 86400); if ($period == '오늘') { - $from = $today; - $to = $from; + $from = $today; + $to = $from; } else if ($period == '어제') { - $from = $yesterday; - $to = $from; + $from = $yesterday; + $to = $from; } else if ($period == '내일') { - $from = date('Y-m-d', G5_SERVER_TIME + (86400 * 2)); - $to = $from; + $from = date('Y-m-d', G5_SERVER_TIME + (86400 * 2)); + $to = $from; } else { - $from = date('Y-m-d', G5_SERVER_TIME - (86400 * $period_array[$period][1])); - $to = $yesterday; + $from = date('Y-m-d', G5_SERVER_TIME - (86400 * $period_array[$period][1])); + $to = $yesterday; } $sql_bo_table = ''; if ($bo_table) - $sql_bo_table = "and bo_table = '$bo_table'"; + $sql_bo_table = "and bo_table = '$bo_table'"; switch ($day) { - case '시간' : - $sql = " select substr(bn_datetime,6,8) as hours, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by hours order by bn_datetime "; - $result = sql_query($sql); - for ($i=0; $row=sql_fetch_array($result); $i++) { - // 월-일 시간 - $line1[] = "['".substr($row['hours'],0,8)."',".$row['wcount'].']'; - $line2[] = "['".substr($row['hours'],0,8)."',".$row['ccount'].']'; - } - break; - case '일' : - $sql = " select substr(bn_datetime,1,10) as days, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by days order by bn_datetime "; - $result = sql_query($sql); - for ($i=0; $row=sql_fetch_array($result); $i++) { - // 월-일 - $line1[] = "['".substr($row['days'],5,5)."',".$row['wcount'].']'; - $line2[] = "['".substr($row['days'],5,5)."',".$row['ccount'].']'; - } - break; - case '주' : - $sql = " select concat(substr(bn_datetime,1,4), '-', weekofyear(bn_datetime)) as weeks, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by weeks order by bn_datetime "; - $result = sql_query($sql); - for ($i=0; $row=sql_fetch_array($result); $i++) { - // 올해의 몇주로 보여주면 바로 확인이 안되므로 주를 날짜로 바꾼다. - // 년-월-일 - list($lyear, $lweek) = explode('-', $row['weeks']); - $date = date('y-m-d', strtotime($lyear.'W'.str_pad($lweek, 2, '0', STR_PAD_LEFT))); - $line1[] = "['".$date."',".$row['wcount'].']'; - $line2[] = "['".$date."',".$row['ccount'].']'; - } - break; - case '월' : - $sql = " select substr(bn_datetime,1,7) as months, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by months order by bn_datetime "; - $result = sql_query($sql); - for ($i=0; $row=sql_fetch_array($result); $i++) { - // 년-월 - $line1[] = "['".substr($row['months'],2,5)."',".$row['wcount'].']'; - $line2[] = "['".substr($row['months'],2,5)."',".$row['ccount'].']'; - } - break; - case '년' : - $sql = " select substr(bn_datetime,1,4) as years, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by years order by bn_datetime "; - $result = sql_query($sql); - for ($i=0; $row=sql_fetch_array($result); $i++) { - // 년(4자리) - $line1[] = "['".substr($row['years'],0,4)."',".$row['wcount'].']'; - $line2[] = "['".substr($row['years'],0,4)."',".$row['ccount'].']'; - } - break; + case '시간': + $sql = " select substr(bn_datetime,6,8) as hours, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by hours order by bn_datetime "; + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + // 월-일 시간 + $line1[] = "['" . substr($row['hours'], 0, 8) . "'," . $row['wcount'] . ']'; + $line2[] = "['" . substr($row['hours'], 0, 8) . "'," . $row['ccount'] . ']'; + } + break; + case '일': + $sql = " select substr(bn_datetime,1,10) as days, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by days order by bn_datetime "; + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + // 월-일 + $line1[] = "['" . substr($row['days'], 5, 5) . "'," . $row['wcount'] . ']'; + $line2[] = "['" . substr($row['days'], 5, 5) . "'," . $row['ccount'] . ']'; + } + break; + case '주': + $sql = " select concat(substr(bn_datetime,1,4), '-', weekofyear(bn_datetime)) as weeks, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by weeks order by bn_datetime "; + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + // 올해의 몇주로 보여주면 바로 확인이 안되므로 주를 날짜로 바꾼다. + // 년-월-일 + list($lyear, $lweek) = explode('-', $row['weeks']); + $date = date('y-m-d', strtotime($lyear . 'W' . str_pad($lweek, 2, '0', STR_PAD_LEFT))); + $line1[] = "['" . $date . "'," . $row['wcount'] . ']'; + $line2[] = "['" . $date . "'," . $row['ccount'] . ']'; + } + break; + case '월': + $sql = " select substr(bn_datetime,1,7) as months, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by months order by bn_datetime "; + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + // 년-월 + $line1[] = "['" . substr($row['months'], 2, 5) . "'," . $row['wcount'] . ']'; + $line2[] = "['" . substr($row['months'], 2, 5) . "'," . $row['ccount'] . ']'; + } + break; + case '년': + $sql = " select substr(bn_datetime,1,4) as years, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by years order by bn_datetime "; + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + // 년(4자리) + $line1[] = "['" . substr($row['years'], 0, 4) . "'," . $row['wcount'] . ']'; + $line2[] = "['" . substr($row['years'], 0, 4) . "'," . $row['ccount'] . ']'; + } + break; } ?>
    -
    + -
    -
      -
    • 글 수
    • -
    • 댓글 수
    • -
    + +
      +
    • 글 수
    • +
    • 댓글 수
    • +

    -그래프를 만들 데이터가 없습니다.\n"; -} else { -?> -
    -
    - - + + \ No newline at end of file + include_once('./admin.tail.php'); + ?> diff --git a/AvocadoEdition_Light/bbs/_common.php b/AvocadoEdition_Light/bbs/_common.php index b556cc9..08a25e5 100644 --- a/AvocadoEdition_Light/bbs/_common.php +++ b/AvocadoEdition_Light/bbs/_common.php @@ -1,3 +1,2 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/_head.php b/AvocadoEdition_Light/bbs/_head.php index c9bf5a4..7b89a1d 100644 --- a/AvocadoEdition_Light/bbs/_head.php +++ b/AvocadoEdition_Light/bbs/_head.php @@ -1,4 +1,4 @@ \ No newline at end of file +if (!defined('_GNUBOARD_')) + exit; // 개별 페이지 접근 불가 +include_once(G5_PATH . '/_head.php'); diff --git a/AvocadoEdition_Light/bbs/_head.sub.php b/AvocadoEdition_Light/bbs/_head.sub.php index 0067cf7..32c808d 100644 --- a/AvocadoEdition_Light/bbs/_head.sub.php +++ b/AvocadoEdition_Light/bbs/_head.sub.php @@ -1,4 +1,4 @@ \ No newline at end of file +if (!defined('_GNUBOARD_')) + exit; // 개별 페이지 접근 불가 +include_once(G5_PATH . '/head.sub.php'); diff --git a/AvocadoEdition_Light/bbs/_tail.php b/AvocadoEdition_Light/bbs/_tail.php index ab638fe..0bedb59 100644 --- a/AvocadoEdition_Light/bbs/_tail.php +++ b/AvocadoEdition_Light/bbs/_tail.php @@ -1,4 +1,4 @@ \ No newline at end of file +if (!defined('_GNUBOARD_')) + exit; // 개별 페이지 접근 불가 +include_once(G5_PATH . '/_tail.php'); diff --git a/AvocadoEdition_Light/bbs/_tail.sub.php b/AvocadoEdition_Light/bbs/_tail.sub.php index 392cf17..11a126a 100644 --- a/AvocadoEdition_Light/bbs/_tail.sub.php +++ b/AvocadoEdition_Light/bbs/_tail.sub.php @@ -1,4 +1,4 @@ \ No newline at end of file +if (!defined('_GNUBOARD_')) + exit; // 개별 페이지 접근 불가 +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/ajax.autosave.php b/AvocadoEdition_Light/bbs/ajax.autosave.php index f8e1308..66cbc0c 100644 --- a/AvocadoEdition_Light/bbs/ajax.autosave.php +++ b/AvocadoEdition_Light/bbs/ajax.autosave.php @@ -1,20 +1,20 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.autosavedel.php b/AvocadoEdition_Light/bbs/ajax.autosavedel.php index c3e7d9d..c1a7e83 100644 --- a/AvocadoEdition_Light/bbs/ajax.autosavedel.php +++ b/AvocadoEdition_Light/bbs/ajax.autosavedel.php @@ -1,15 +1,15 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.autosavelist.php b/AvocadoEdition_Light/bbs/ajax.autosavelist.php index 7aff8e1..b77e4af 100644 --- a/AvocadoEdition_Light/bbs/ajax.autosavelist.php +++ b/AvocadoEdition_Light/bbs/ajax.autosavelist.php @@ -1,21 +1,21 @@ \n"; echo "\n"; -for ($i=0; $row=sql_fetch_array($result); $i++) { - $subject = htmlspecialchars(utf8_strcut($row['as_subject'], 25), ENT_QUOTES); - $datetime = substr($row['as_datetime'],2,14); - echo "\n"; - echo "{$row['as_id']}\n"; - echo "{$row['as_uid']}\n"; - echo "\n"; - echo "{$datetime}\n"; - echo "\n"; +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $subject = htmlspecialchars(utf8_strcut($row['as_subject'], 25), ENT_QUOTES); + $datetime = substr($row['as_datetime'], 2, 14); + echo "\n"; + echo "{$row['as_id']}\n"; + echo "{$row['as_uid']}\n"; + echo "\n"; + echo "{$datetime}\n"; + echo "\n"; } echo ""; -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.autosaveload.php b/AvocadoEdition_Light/bbs/ajax.autosaveload.php index 2e55e5f..c55496b 100644 --- a/AvocadoEdition_Light/bbs/ajax.autosaveload.php +++ b/AvocadoEdition_Light/bbs/ajax.autosaveload.php @@ -1,9 +1,10 @@ \n"; echo "\n"; echo "\n"; echo "\n"; -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.comment_token.php b/AvocadoEdition_Light/bbs/ajax.comment_token.php index c90b09b..149dc62 100644 --- a/AvocadoEdition_Light/bbs/ajax.comment_token.php +++ b/AvocadoEdition_Light/bbs/ajax.comment_token.php @@ -1,6 +1,6 @@ $token))); -?> \ No newline at end of file +die(json_encode(array('token' => $token))); diff --git a/AvocadoEdition_Light/bbs/ajax.filter.php b/AvocadoEdition_Light/bbs/ajax.filter.php index 0e3a21e..8b527c3 100644 --- a/AvocadoEdition_Light/bbs/ajax.filter.php +++ b/AvocadoEdition_Light/bbs/ajax.filter.php @@ -7,25 +7,24 @@ $content = strip_tags($_POST['content']); //$filter = explode(",", strtolower(trim($config['cf_filter']))); // strtolower 에 의한 한글 변형으로 아래 코드로 대체 (곱슬최씨님이 알려 주셨습니다.) $filter = explode(",", trim($config['cf_filter'])); -for ($i=0; $i \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.mb_email.php b/AvocadoEdition_Light/bbs/ajax.mb_email.php index fbd1632..dffc65f 100644 --- a/AvocadoEdition_Light/bbs/ajax.mb_email.php +++ b/AvocadoEdition_Light/bbs/ajax.mb_email.php @@ -1,16 +1,19 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.mb_hp.php b/AvocadoEdition_Light/bbs/ajax.mb_hp.php index eeeef88..652b158 100644 --- a/AvocadoEdition_Light/bbs/ajax.mb_hp.php +++ b/AvocadoEdition_Light/bbs/ajax.mb_hp.php @@ -1,10 +1,10 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.mb_id.php b/AvocadoEdition_Light/bbs/ajax.mb_id.php index 9adfd1e..9f0c4da 100644 --- a/AvocadoEdition_Light/bbs/ajax.mb_id.php +++ b/AvocadoEdition_Light/bbs/ajax.mb_id.php @@ -1,16 +1,20 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.mb_nick.php b/AvocadoEdition_Light/bbs/ajax.mb_nick.php index 9c22c5d..c0b0ff6 100644 --- a/AvocadoEdition_Light/bbs/ajax.mb_nick.php +++ b/AvocadoEdition_Light/bbs/ajax.mb_nick.php @@ -1,17 +1,21 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/ajax.mb_recommend.php b/AvocadoEdition_Light/bbs/ajax.mb_recommend.php index bdc7964..b25e0ee 100644 --- a/AvocadoEdition_Light/bbs/ajax.mb_recommend.php +++ b/AvocadoEdition_Light/bbs/ajax.mb_recommend.php @@ -1,13 +1,12 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/alert.php b/AvocadoEdition_Light/bbs/alert.php index f6f779c..53470ae 100644 --- a/AvocadoEdition_Light/bbs/alert.php +++ b/AvocadoEdition_Light/bbs/alert.php @@ -4,12 +4,12 @@ global $lo_url; include_once('./_common.php'); -if($error) { - $g5['title'] = "오류안내 페이지"; +if ($error) { + $g5['title'] = "오류안내 페이지"; } else { - $g5['title'] = "결과안내 페이지"; + $g5['title'] = "결과안내 페이지"; } -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); // 필수 입력입니다. // 양쪽 공백 없애기 // 필수 (선택 혹은 입력)입니다. @@ -31,83 +31,84 @@ include_once(G5_PATH.'/head.sub.php'); $msg2 = str_replace("\\n", "
    ", $msg); $url = clean_xss_tags($url); -if (!$url) $url = clean_xss_tags($_SERVER['HTTP_REFERER']); +if (!$url) + $url = clean_xss_tags($_SERVER['HTTP_REFERER']); $url = preg_replace("/[\<\>\'\"\\\'\\\"\(\)]/", "", $url); // url 체크 check_url_host($url); -if($error) { - $header2 = "다음 항목에 오류가 있습니다."; +if ($error) { + $header2 = "다음 항목에 오류가 있습니다."; } else { - $header2 = "다음 내용을 확인해 주세요."; + $header2 = "다음 내용을 확인해 주세요."; } ?>
    \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); +?> diff --git a/AvocadoEdition_Light/bbs/alert_close.php b/AvocadoEdition_Light/bbs/alert_close.php index 830b3c6..1abaced 100644 --- a/AvocadoEdition_Light/bbs/alert_close.php +++ b/AvocadoEdition_Light/bbs/alert_close.php @@ -1,54 +1,54 @@ ", $msg); -if($error) { - $header2 = "다음 항목에 오류가 있습니다."; - $msg3 = "새창을 닫으시고 이전 작업을 다시 시도해 주세요."; +if ($error) { + $header2 = "다음 항목에 오류가 있습니다."; + $msg3 = "새창을 닫으시고 이전 작업을 다시 시도해 주세요."; } else { - $header2 = "다음 내용을 확인해 주세요."; - $msg3 = "새창을 닫으신 후 서비스를 이용해 주세요."; + $header2 = "다음 내용을 확인해 주세요."; + $msg3 = "새창을 닫으신 후 서비스를 이용해 주세요."; } ?> \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); +?> diff --git a/AvocadoEdition_Light/bbs/board.php b/AvocadoEdition_Light/bbs/board.php index fd12e81..07b4aeb 100644 --- a/AvocadoEdition_Light/bbs/board.php +++ b/AvocadoEdition_Light/bbs/board.php @@ -2,246 +2,242 @@ include_once('./_common.php'); if (!$board['bo_table']) { - goto_url(G5_URL); + goto_url(G5_URL); } check_device($board['bo_device']); if (isset($write['wr_is_comment']) && $write['wr_is_comment']) { - goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$write['wr_parent'].'#c_'.$wr_id); + goto_url('./board.php?bo_table=' . $bo_table . '&wr_id=' . $write['wr_parent'] . '#c_' . $wr_id); } if (!$bo_table) { - $msg = "bo_table 값이 넘어오지 않았습니다.\\n\\nboard.php?bo_table=code 와 같은 방식으로 넘겨 주세요."; - alert($msg); + $msg = "bo_table 값이 넘어오지 않았습니다.\\n\\nboard.php?bo_table=code 와 같은 방식으로 넘겨 주세요."; + alert($msg); } // wr_id 값이 있으면 글읽기 if (isset($wr_id) && $wr_id) { - // 글이 없을 경우 해당 게시판 목록으로 이동 - if (!$write['wr_id']) { - $msg = '글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니다.'; - alert($msg, './board.php?bo_table='.$bo_table); - } + // 글이 없을 경우 해당 게시판 목록으로 이동 + if (!$write['wr_id']) { + $msg = '글이 존재하지 않습니다.\\n\\n글이 삭제되었거나 이동된 경우입니다.'; + alert($msg, './board.php?bo_table=' . $bo_table); + } - // 그룹접근 사용 - if (isset($group['gr_use_access']) && $group['gr_use_access']) { - if ($is_guest) { - $msg = "비회원은 이 게시판에 접근할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오."; - alert($msg, './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr)); - } + // 그룹접근 사용 + if (isset($group['gr_use_access']) && $group['gr_use_access']) { + if ($is_guest) { + $msg = "비회원은 이 게시판에 접근할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오."; + alert($msg, './login.php?wr_id=' . $wr_id . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . $qstr)); + } - // 그룹관리자 이상이라면 통과 - if ($is_admin == "super" || $is_admin == "group") { - ; - } else { - // 그룹접근 - $sql = " select count(*) as cnt from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' "; - $row = sql_fetch($sql); - if (!$row['cnt']) { - alert("접근 권한이 없으므로 글읽기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.", G5_URL); - } - } - } + // 그룹관리자 이상이라면 통과 + if ($is_admin == "super" || $is_admin == "group") { + ; + } else { + // 그룹접근 + $sql = " select count(*) as cnt from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' "; + $row = sql_fetch($sql); + if (!$row['cnt']) { + alert("접근 권한이 없으므로 글읽기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.", G5_URL); + } + } + } - // 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면 - if ($member['mb_level'] < $board['bo_read_level']) { - if ($is_member) - alert('글을 읽을 권한이 없습니다.', G5_URL); - else - alert('글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr)); - } + // 로그인된 회원의 권한이 설정된 읽기 권한보다 작다면 + if ($member['mb_level'] < $board['bo_read_level']) { + if ($is_member) + alert('글을 읽을 권한이 없습니다.', G5_URL); + else + alert('글을 읽을 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id=' . $wr_id . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . $qstr)); + } - // 본인확인을 사용한다면 - if ($config['cf_cert_use'] && !$is_admin) { - // 인증된 회원만 가능 - if ($board['bo_use_cert'] != '' && $is_guest) { - alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr)); - } + // 본인확인을 사용한다면 + if ($config['cf_cert_use'] && !$is_admin) { + // 인증된 회원만 가능 + if ($board['bo_use_cert'] != '' && $is_guest) { + alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id=' . $wr_id . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . $qstr)); + } - if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { - alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { + alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { - alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { + alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { - alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { + alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { - alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL); - } - } + if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { + alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL); + } + } - // 자신의 글이거나 관리자라면 통과 - if (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin) { - ; - } else { - // 비밀글이라면 - if (strstr($write['wr_option'], "secret")) - { - // 회원이 비밀글을 올리고 관리자가 답변글을 올렸을 경우 - // 회원이 관리자가 올린 답변글을 바로 볼 수 없던 오류를 수정 - $is_owner = false; - if ($write['wr_reply'] && $member['mb_id']) - { - $sql = " select mb_id from {$write_table} + // 자신의 글이거나 관리자라면 통과 + if (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin) { + ; + } else { + // 비밀글이라면 + if (strstr($write['wr_option'], "secret")) { + // 회원이 비밀글을 올리고 관리자가 답변글을 올렸을 경우 + // 회원이 관리자가 올린 답변글을 바로 볼 수 없던 오류를 수정 + $is_owner = false; + if ($write['wr_reply'] && $member['mb_id']) { + $sql = " select mb_id from {$write_table} where wr_num = '{$write['wr_num']}' and wr_reply = '' and wr_is_comment = 0 "; - $row = sql_fetch($sql); - if ($row['mb_id'] == $member['mb_id']) - $is_owner = true; - } + $row = sql_fetch($sql); + if ($row['mb_id'] == $member['mb_id']) + $is_owner = true; + } - $ss_name = 'ss_secret_'.$bo_table.'_'.$write['wr_num']; + $ss_name = 'ss_secret_' . $bo_table . '_' . $write['wr_num']; - if (!$is_owner) - { - //$ss_name = "ss_secret_{$bo_table}_{$wr_id}"; - // 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우는 다시 비밀번호를 묻지 않습니다. - // 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면 - //if ("$bo_table|$write['wr_num']" != get_session("ss_secret")) - if (!get_session($ss_name)) - goto_url('./password.php?w=s&bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr); - } + if (!$is_owner) { + //$ss_name = "ss_secret_{$bo_table}_{$wr_id}"; + // 한번 읽은 게시물의 번호는 세션에 저장되어 있고 같은 게시물을 읽을 경우는 다시 비밀번호를 묻지 않습니다. + // 이 게시물이 저장된 게시물이 아니면서 관리자가 아니라면 + //if ("$bo_table|$write['wr_num']" != get_session("ss_secret")) + if (!get_session($ss_name)) + goto_url('./password.php?w=s&bo_table=' . $bo_table . '&wr_id=' . $wr_id . $qstr); + } - set_session($ss_name, TRUE); - } - } + set_session($ss_name, TRUE); + } + } - // 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음 - $ss_name = 'ss_view_'.$bo_table.'_'.$wr_id; - if (!get_session($ss_name)) - { - sql_query(" update {$write_table} set wr_hit = wr_hit + 1 where wr_id = '{$wr_id}' "); + // 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음 + $ss_name = 'ss_view_' . $bo_table . '_' . $wr_id; + if (!get_session($ss_name)) { + sql_query(" update {$write_table} set wr_hit = wr_hit + 1 where wr_id = '{$wr_id}' "); - // 자신의 글이면 통과 - if ($write['mb_id'] && $write['mb_id'] == $member['mb_id']) { - ; - } else if ($is_guest && $board['bo_read_level'] == 1 && $write['wr_ip'] == $_SERVER['REMOTE_ADDR']) { - // 비회원이면서 읽기레벨이 1이고 등록된 아이피가 같다면 자신의 글이므로 통과 - ; - } else { - // 글읽기 포인트가 설정되어 있다면 - if ($config['cf_use_point'] && $board['bo_read_point'] && $member['mb_point'] + $board['bo_read_point'] < 0) - alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글읽기('.number_format($board['bo_read_point']).')가 불가합니다.\\n\\n포인트를 모으신 후 다시 글읽기 해 주십시오.'); + // 자신의 글이면 통과 + if ($write['mb_id'] && $write['mb_id'] == $member['mb_id']) { + ; + } else if ($is_guest && $board['bo_read_level'] == 1 && $write['wr_ip'] == $_SERVER['REMOTE_ADDR']) { + // 비회원이면서 읽기레벨이 1이고 등록된 아이피가 같다면 자신의 글이므로 통과 + ; + } else { + // 글읽기 포인트가 설정되어 있다면 + if ($config['cf_use_point'] && $board['bo_read_point'] && $member['mb_point'] + $board['bo_read_point'] < 0) + alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 글읽기(' . number_format($board['bo_read_point']) . ')가 불가합니다.\\n\\n포인트를 모으신 후 다시 글읽기 해 주십시오.'); - insert_point($member['mb_id'], $board['bo_read_point'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$wr_id.' 글읽기', $bo_table, $wr_id, '읽기'); - } + insert_point($member['mb_id'], $board['bo_read_point'], ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']) . ' ' . $wr_id . ' 글읽기', $bo_table, $wr_id, '읽기'); + } - set_session($ss_name, TRUE); - } + set_session($ss_name, TRUE); + } - $g5['title'] = strip_tags(conv_subject($write['wr_subject'], 255))." > ".((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']); + $g5['title'] = strip_tags(conv_subject($write['wr_subject'], 255)) . " > " . ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']); } else { - if ($member['mb_level'] < $board['bo_list_level']) { - if ($member['mb_id']) - alert('목록을 볼 권한이 없습니다.', G5_URL); - else - alert('목록을 볼 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.($qstr?'&':''))); - } + if ($member['mb_level'] < $board['bo_list_level']) { + if ($member['mb_id']) + alert('목록을 볼 권한이 없습니다.', G5_URL); + else + alert('목록을 볼 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?' . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . ($qstr ? '&' : ''))); + } - // 본인확인을 사용한다면 - if ($config['cf_cert_use'] && !$is_admin) { - // 인증된 회원만 가능 - if ($board['bo_use_cert'] != '' && $is_guest) { - alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id='.$wr_id.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr)); - } + // 본인확인을 사용한다면 + if ($config['cf_cert_use'] && !$is_admin) { + // 인증된 회원만 가능 + if ($board['bo_use_cert'] != '' && $is_guest) { + alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?wr_id=' . $wr_id . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . $qstr)); + } - if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { - alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { + alert('이 게시판은 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { - alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { + alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { - alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { + alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { - alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL); - } - } + if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { + alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL); + } + } - if (!isset($page) || (isset($page) && $page == 0)) $page = 1; + if (!isset($page) || (isset($page) && $page == 0)) + $page = 1; - $g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$page.' 페이지'; + $g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']) . ' ' . $page . ' 페이지'; } -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); $width = $board['bo_table_width']; if ($width <= 100) - $width .= '%'; + $width .= '%'; else - $width .='px'; + $width .= 'px'; // IP보이기 사용 여부 $ip = ""; $is_ip_view = $board['bo_use_ip_view']; if ($is_admin) { - $is_ip_view = true; - if (array_key_exists('wr_ip', $write)) { - $ip = $write['wr_ip']; - } + $is_ip_view = true; + if (array_key_exists('wr_ip', $write)) { + $ip = $write['wr_ip']; + } } else { - // 관리자가 아니라면 IP 주소를 감춘후 보여줍니다. - if (isset($write['wr_ip'])) { - $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $write['wr_ip']); - } + // 관리자가 아니라면 IP 주소를 감춘후 보여줍니다. + if (isset($write['wr_ip'])) { + $ip = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $write['wr_ip']); + } } // 분류 사용 $is_category = false; $category_name = ''; if ($board['bo_use_category']) { - $is_category = true; - if (array_key_exists('ca_name', $write)) { - $category_name = $write['ca_name']; // 분류명 - } + $is_category = true; + if (array_key_exists('ca_name', $write)) { + $category_name = $write['ca_name']; // 분류명 + } } // 추천 사용 $is_good = false; if ($board['bo_use_good']) - $is_good = true; + $is_good = true; // 비추천 사용 $is_nogood = false; if ($board['bo_use_nogood']) - $is_nogood = true; + $is_nogood = true; $admin_href = ""; // 최고관리자 또는 그룹관리자라면 if ($member['mb_id'] && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'])) - $admin_href = G5_ADMIN_URL.'/board_form.php?w=u&bo_table='.$bo_table; + $admin_href = G5_ADMIN_URL . '/board_form.php?w=u&bo_table=' . $bo_table; -include_once(G5_BBS_PATH.'/board_head.php'); +include_once(G5_BBS_PATH . '/board_head.php'); // 게시물 아이디가 있다면 게시물 보기를 INCLUDE if (isset($wr_id) && $wr_id) { - include_once(G5_BBS_PATH.'/view.php'); + include_once(G5_BBS_PATH . '/view.php'); } // 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임 //if ($board['bo_use_list_view'] || empty($wr_id)) -if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id)) { - if($board['bo_type'] == 'mmb') - include_once (G5_BBS_PATH.'/list.mmb.php'); - else - include_once (G5_BBS_PATH.'/list.php'); +if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id)) { + if ($board['bo_type'] == 'mmb') + include_once(G5_BBS_PATH . '/list.mmb.php'); + else + include_once(G5_BBS_PATH . '/list.php'); } -include_once(G5_BBS_PATH.'/board_tail.php'); +include_once(G5_BBS_PATH . '/board_tail.php'); -echo "\n\n"; +echo "\n\n"; -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/board_head.php b/AvocadoEdition_Light/bbs/board_head.php index f426956..4554d81 100644 --- a/AvocadoEdition_Light/bbs/board_head.php +++ b/AvocadoEdition_Light/bbs/board_head.php @@ -1,6 +1,6 @@ \ No newline at end of file +include_once(G5_BBS_PATH . '/_head.php'); +@include($board['bo_include_head']); diff --git a/AvocadoEdition_Light/bbs/board_list_update.php b/AvocadoEdition_Light/bbs/board_list_update.php index a439240..587cbd1 100644 --- a/AvocadoEdition_Light/bbs/board_list_update.php +++ b/AvocadoEdition_Light/bbs/board_list_update.php @@ -3,19 +3,18 @@ include_once('./_common.php'); $count = count($_POST['chk_wr_id']); -if(!$count) { - alert($_POST['btn_submit'].' 하실 항목을 하나 이상 선택하세요.'); +if (!$count) { + alert($_POST['btn_submit'] . ' 하실 항목을 하나 이상 선택하세요.'); } -if($_POST['btn_submit'] == '선택삭제') { - include './delete_all.php'; -} else if($_POST['btn_submit'] == '선택복사') { - $sw = 'copy'; - include './move.php'; -} else if($_POST['btn_submit'] == '선택이동') { - $sw = 'move'; - include './move.php'; +if ($_POST['btn_submit'] == '선택삭제') { + include './delete_all.php'; +} else if ($_POST['btn_submit'] == '선택복사') { + $sw = 'copy'; + include './move.php'; +} else if ($_POST['btn_submit'] == '선택이동') { + $sw = 'move'; + include './move.php'; } else { - alert('올바른 방법으로 이용해 주세요.'); + alert('올바른 방법으로 이용해 주세요.'); } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/board_tail.php b/AvocadoEdition_Light/bbs/board_tail.php index d0f8289..44eb8b1 100644 --- a/AvocadoEdition_Light/bbs/board_tail.php +++ b/AvocadoEdition_Light/bbs/board_tail.php @@ -1,6 +1,6 @@ \ No newline at end of file +@include($board['bo_include_tail']); +include_once(G5_BBS_PATH . '/_tail.php'); diff --git a/AvocadoEdition_Light/bbs/character_list.php b/AvocadoEdition_Light/bbs/character_list.php index 8763b1a..302539e 100644 --- a/AvocadoEdition_Light/bbs/character_list.php +++ b/AvocadoEdition_Light/bbs/character_list.php @@ -121,7 +121,8 @@ if ($profile['ad_use_rank']) { + + @@ -132,7 +133,8 @@ if ($profile['ad_use_rank']) { + + @@ -247,7 +249,8 @@ if ($profile['ad_use_rank']) { + + @@ -258,7 +261,8 @@ if ($profile['ad_use_rank']) { + + diff --git a/AvocadoEdition_Light/bbs/confirm.php b/AvocadoEdition_Light/bbs/confirm.php index fcf94e0..bb06ed1 100644 --- a/AvocadoEdition_Light/bbs/confirm.php +++ b/AvocadoEdition_Light/bbs/confirm.php @@ -1,6 +1,6 @@ - \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/content.php b/AvocadoEdition_Light/bbs/content.php index c4003bd..2186e10 100644 --- a/AvocadoEdition_Light/bbs/content.php +++ b/AvocadoEdition_Light/bbs/content.php @@ -2,8 +2,8 @@ include_once('./_common.php'); //dbconfig파일에 $g5['content_table'] 배열변수가 있는지 체크 -if( !isset($g5['content_table']) ){ - die('관리자 모드에서 게시판관리->내용 관리를 먼저 확인해 주세요.'); +if (!isset($g5['content_table'])) { + die('관리자 모드에서 게시판관리->내용 관리를 먼저 확인해 주세요.'); } @@ -12,15 +12,15 @@ if( !isset($g5['content_table']) ){ $sql = " select * from {$g5['content_table']} where co_id = '$co_id' "; $co = sql_fetch($sql); if (!$co['co_id']) - alert('등록된 내용이 없습니다.'); + alert('등록된 내용이 없습니다.'); $g5['title'] = $co['co_subject']; if (is_include_path_check($co['co_include_head'])) - @include_once($co['co_include_head']); + @include_once($co['co_include_head']); else - include_once('./_head.php'); + include_once('./_head.php'); $str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']); @@ -57,34 +57,33 @@ $dst[] = $default['de_admin_info_email']; $str = preg_replace($src, $dst, $str); // 스킨경로 -if(trim($co['co_skin']) == '') - $co['co_skin'] = 'basic'; +if (trim($co['co_skin']) == '') + $co['co_skin'] = 'basic'; $content_skin_path = get_skin_path('content', $co['co_skin']); -$content_skin_url = get_skin_url('content', $co['co_skin']); -$skin_file = $content_skin_path.'/content.skin.php'; +$content_skin_url = get_skin_url('content', $co['co_skin']); +$skin_file = $content_skin_path . '/content.skin.php'; if ($is_admin) - echo ''; + echo ''; ?>
    '; +if (is_file($skin_file)) { + $himg = G5_DATA_PATH . '/content/' . $co_id . '_h'; + if (file_exists($himg)) // 상단 이미지 + echo '
    '; - include($skin_file); + include($skin_file); - $timg = G5_DATA_PATH.'/content/'.$co_id.'_t'; - if (file_exists($timg)) // 하단 이미지 - echo '
    '; + $timg = G5_DATA_PATH . '/content/' . $co_id . '_t'; + if (file_exists($timg)) // 하단 이미지 + echo '
    '; } else { - echo '

    '.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.

    '; + echo '

    ' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.

    '; } if (is_include_path_check($co['co_include_tail'])) - @include_once($co['co_include_tail']); + @include_once($co['co_include_tail']); else - include_once('./_tail.php'); -?> + include_once('./_tail.php'); diff --git a/AvocadoEdition_Light/bbs/current_connect.php b/AvocadoEdition_Light/bbs/current_connect.php index 3532a00..6c9785c 100644 --- a/AvocadoEdition_Light/bbs/current_connect.php +++ b/AvocadoEdition_Light/bbs/current_connect.php @@ -11,28 +11,27 @@ $sql = " select a.mb_id, b.mb_nick, b.mb_name, b.mb_email, b.mb_homepage, b.mb_o where a.mb_id <> '{$config['cf_admin']}' order by a.lo_datetime desc "; $result = sql_query($sql); -for ($i=0; $row=sql_fetch_array($result); $i++) { - $row['lo_url'] = get_text($row['lo_url']); - $list[$i] = $row; +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $row['lo_url'] = get_text($row['lo_url']); + $list[$i] = $row; - if ($row['mb_id']) { - $list[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['mb_nick'], $config['cf_cut_name']), $row['mb_email'], $row['mb_homepage']); + if ($row['mb_id']) { + $list[$i]['name'] = get_sideview($row['mb_id'], cut_str($row['mb_nick'], $config['cf_cut_name']), $row['mb_email'], $row['mb_homepage']); + } else { + $ip_member = sql_fetch("select mb_name, mb_id from {$g5['member_table']} where mb_login_ip = '{$row['lo_ip']}' OR mb_ip = '{$row['lo_ip']}'"); + if ($ip_member['mb_id']) { + $list[$i]['name'] = $ip_member['mb_name']; } else { - $ip_member = sql_fetch("select mb_name, mb_id from {$g5['member_table']} where mb_login_ip = '{$row['lo_ip']}' OR mb_ip = '{$row['lo_ip']}'"); - if($ip_member['mb_id']) { - $list[$i]['name'] = $ip_member['mb_name']; - } else { - if ($is_admin) - $list[$i]['name'] = $row['lo_ip']; - else - $list[$i]['name'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['lo_ip']); - } + if ($is_admin) + $list[$i]['name'] = $row['lo_ip']; + else + $list[$i]['name'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $row['lo_ip']); } + } - $list[$i]['num'] = sprintf('%03d',$i+1); + $list[$i]['num'] = sprintf('%03d', $i + 1); } -include_once($connect_skin_path.'/current_connect.skin.php'); +include_once($connect_skin_path . '/current_connect.skin.php'); include_once('./_tail.php'); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/db_table.optimize.php b/AvocadoEdition_Light/bbs/db_table.optimize.php index 8289230..db2eac5 100644 --- a/AvocadoEdition_Light/bbs/db_table.optimize.php +++ b/AvocadoEdition_Light/bbs/db_table.optimize.php @@ -1,69 +1,68 @@ = G5_TIME_YMD) - return; +if (isset($config['cf_optimize_date']) && $config['cf_optimize_date'] >= G5_TIME_YMD) + return; // 설정일이 지난 접속자로그 삭제 -if($config['cf_visit_del'] > 0) { - $tmp_before_date = date("Y-m-d", G5_SERVER_TIME - ($config['cf_visit_del'] * 86400)); - $sql = " delete from {$g5['visit_table']} where vi_date < '$tmp_before_date' "; - sql_query($sql); - sql_query(" OPTIMIZE TABLE `{$g5['visit_table']}`, `{$g5['visit_sum_table']}` "); +if ($config['cf_visit_del'] > 0) { + $tmp_before_date = date("Y-m-d", G5_SERVER_TIME - ($config['cf_visit_del'] * 86400)); + $sql = " delete from {$g5['visit_table']} where vi_date < '$tmp_before_date' "; + sql_query($sql); + sql_query(" OPTIMIZE TABLE `{$g5['visit_table']}`, `{$g5['visit_sum_table']}` "); } // 설정일이 지난 인기검색어 삭제 -if($config['cf_popular_del'] > 0) { - $tmp_before_date = date("Y-m-d", G5_SERVER_TIME - ($config['cf_popular_del'] * 86400)); - $sql = " delete from {$g5['popular_table']} where pp_date < '$tmp_before_date' "; - sql_query($sql); - sql_query(" OPTIMIZE TABLE `{$g5['popular_table']}` "); +if ($config['cf_popular_del'] > 0) { + $tmp_before_date = date("Y-m-d", G5_SERVER_TIME - ($config['cf_popular_del'] * 86400)); + $sql = " delete from {$g5['popular_table']} where pp_date < '$tmp_before_date' "; + sql_query($sql); + sql_query(" OPTIMIZE TABLE `{$g5['popular_table']}` "); } // 설정일이 지난 최근게시물 삭제 -if($config['cf_new_del'] > 0) { - $sql = " delete from {$g5['board_new_table']} where (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS(bn_datetime)) > '{$config['cf_new_del']}' "; - sql_query($sql); - sql_query(" OPTIMIZE TABLE `{$g5['board_new_table']}` "); +if ($config['cf_new_del'] > 0) { + $sql = " delete from {$g5['board_new_table']} where (TO_DAYS('" . G5_TIME_YMDHIS . "') - TO_DAYS(bn_datetime)) > '{$config['cf_new_del']}' "; + sql_query($sql); + sql_query(" OPTIMIZE TABLE `{$g5['board_new_table']}` "); } // 설정일이 지난 쪽지 삭제 -if($config['cf_memo_del'] > 0) { - $sql = " delete from {$g5['memo_table']} where (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS(me_send_datetime)) > '{$config['cf_memo_del']}' "; - sql_query($sql); - sql_query(" OPTIMIZE TABLE `{$g5['memo_table']}` "); +if ($config['cf_memo_del'] > 0) { + $sql = " delete from {$g5['memo_table']} where (TO_DAYS('" . G5_TIME_YMDHIS . "') - TO_DAYS(me_send_datetime)) > '{$config['cf_memo_del']}' "; + sql_query($sql); + sql_query(" OPTIMIZE TABLE `{$g5['memo_table']}` "); } // 탈퇴회원 자동 삭제 -if($config['cf_leave_day'] > 0) { - $sql = " select mb_id from {$g5['member_table']} - where (TO_DAYS('".G5_TIME_YMDHIS."') - TO_DAYS(mb_leave_date)) > '{$config['cf_leave_day']}' +if ($config['cf_leave_day'] > 0) { + $sql = " select mb_id from {$g5['member_table']} + where (TO_DAYS('" . G5_TIME_YMDHIS . "') - TO_DAYS(mb_leave_date)) > '{$config['cf_leave_day']}' and mb_memo not regexp '^[0-9]{8}.*삭제함' "; - $result = sql_query($sql); - while ($row=sql_fetch_array($result)) - { - // 회원자료 삭제 - member_delete($row['mb_id']); - } + $result = sql_query($sql); + while ($row = sql_fetch_array($result)) { + // 회원자료 삭제 + member_delete($row['mb_id']); + } } // 음성 캡챠 파일 삭제 -$captcha_mp3 = glob(G5_PATH.'/data/cache/kcaptcha-*.mp3'); -if($captcha_mp3 && is_array($captcha_mp3)) { - foreach ($captcha_mp3 as $file) { - if (filemtime($file) + 86400 < G5_SERVER_TIME) { - @unlink($file); - } +$captcha_mp3 = glob(G5_PATH . '/data/cache/kcaptcha-*.mp3'); +if ($captcha_mp3 && is_array($captcha_mp3)) { + foreach ($captcha_mp3 as $file) { + if (filemtime($file) + 86400 < G5_SERVER_TIME) { + @unlink($file); } + } } // 실행일 기록 -if(isset($config['cf_optimize_date'])) { - sql_query(" update {$g5['config_table']} set cf_optimize_date = '".G5_TIME_YMD."' "); +if (isset($config['cf_optimize_date'])) { + sql_query(" update {$g5['config_table']} set cf_optimize_date = '" . G5_TIME_YMD . "' "); } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/delete.php b/AvocadoEdition_Light/bbs/delete.php index 1a288f0..086ecab 100644 --- a/AvocadoEdition_Light/bbs/delete.php +++ b/AvocadoEdition_Light/bbs/delete.php @@ -5,38 +5,39 @@ $delete_token = get_session('ss_delete_token'); set_session('ss_delete_token', ''); /* if (!($token && $delete_token == $token)) - alert('토큰 에러로 삭제 불가합니다.'); + alert('토큰 에러로 삭제 불가합니다.'); */ //$wr = sql_fetch(" select * from $write_table where wr_id = '$wr_id' "); -@include_once($board_skin_path.'/delete.head.skin.php'); +@include_once($board_skin_path . '/delete.head.skin.php'); if ($is_admin == 'super') // 최고관리자 통과 - ; + ; else if ($is_admin == 'group') { // 그룹관리자 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가? - alert('자신이 관리하는 그룹의 게시판이 아니므로 삭제할 수 없습니다.'); - else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 삭제할 수 없습니다.'); + $mb = get_member($write['mb_id']); + if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가? + alert('자신이 관리하는 그룹의 게시판이 아니므로 삭제할 수 없습니다.'); + else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 삭제할 수 없습니다.'); } else if ($is_admin == 'board') { // 게시판관리자이면 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가? - alert('자신이 관리하는 게시판이 아니므로 삭제할 수 없습니다.'); - else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 삭제할 수 없습니다.'); + $mb = get_member($write['mb_id']); + if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가? + alert('자신이 관리하는 게시판이 아니므로 삭제할 수 없습니다.'); + else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 삭제할 수 없습니다.'); } else if ($member['mb_id']) { - if ($member['mb_id'] != $write['mb_id']) - alert('자신의 글이 아니므로 삭제할 수 없습니다.'); + if ($member['mb_id'] != $write['mb_id']) + alert('자신의 글이 아니므로 삭제할 수 없습니다.'); } else { - if ($write['mb_id']) - alert('로그인 후 삭제하세요.', './login.php?url='.urlencode('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id)); - else if (!check_password($wr_password, $write['wr_password'])) - alert('비밀번호가 틀리므로 삭제할 수 없습니다.'); + if ($write['mb_id']) + alert('로그인 후 삭제하세요.', './login.php?url=' . urlencode('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id)); + else if (!check_password($wr_password, $write['wr_password'])) + alert('비밀번호가 틀리므로 삭제할 수 없습니다.'); } $len = strlen($write['wr_reply']); -if ($len < 0) $len = 0; +if ($len < 0) + $len = 0; $reply = substr($write['wr_reply'], 0, $len); // 원글만 구한다. @@ -47,7 +48,7 @@ $sql = " select count(*) as cnt from $write_table and wr_is_comment = 0 "; $row = sql_fetch($sql); if ($row['cnt'] && !$is_admin) - alert('이 글과 관련된 답변글이 존재하므로 삭제 할 수 없습니다.\\n\\n우선 답변글부터 삭제하여 주십시오.'); + alert('이 글과 관련된 답변글이 존재하므로 삭제 할 수 없습니다.\\n\\n우선 답변글부터 삭제하여 주십시오.'); // 코멘트 달린 원글의 삭제 여부 $sql = " select count(*) as cnt from $write_table @@ -57,53 +58,49 @@ $sql = " select count(*) as cnt from $write_table $row = sql_fetch($sql); $board['bo_count_delete'] = 1000; if ($row['cnt'] >= $board['bo_count_delete'] && !$is_admin) - alert('이 글과 관련된 코멘트가 존재하므로 삭제 할 수 없습니다.\\n\\n코멘트가 '.$board['bo_count_delete'].'건 이상 달린 원글은 삭제할 수 없습니다.'); + alert('이 글과 관련된 코멘트가 존재하므로 삭제 할 수 없습니다.\\n\\n코멘트가 ' . $board['bo_count_delete'] . '건 이상 달린 원글은 삭제할 수 없습니다.'); // 사용자 코드 실행 -@include_once($board_skin_path.'/delete.skin.php'); +@include_once($board_skin_path . '/delete.skin.php'); // 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다. //$sql = " select wr_id, mb_id, wr_comment from $write_table where wr_parent = '$write['wr_id']' order by wr_id "; $sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id "; $result = sql_query($sql); -while ($row = sql_fetch_array($result)) -{ - // 원글이라면 - if (!$row['wr_is_comment']) - { - // 원글 포인트 삭제 - if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기')) - insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글삭제"); +while ($row = sql_fetch_array($result)) { + // 원글이라면 + if (!$row['wr_is_comment']) { + // 원글 포인트 삭제 + if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기')) + insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글삭제"); - // 업로드된 파일이 있다면 파일삭제 - $sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "; - $result2 = sql_query($sql2); - while ($row2 = sql_fetch_array($result2)) { - @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); - // 썸네일삭제 - if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { - delete_board_thumbnail($bo_table, $row2['bf_file']); - } - } + // 업로드된 파일이 있다면 파일삭제 + $sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "; + $result2 = sql_query($sql2); + while ($row2 = sql_fetch_array($result2)) { + @unlink(G5_DATA_PATH . '/file/' . $bo_table . '/' . $row2['bf_file']); + // 썸네일삭제 + if (preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { + delete_board_thumbnail($bo_table, $row2['bf_file']); + } + } - // 에디터 썸네일 삭제 - delete_editor_thumbnail($row['wr_content']); + // 에디터 썸네일 삭제 + delete_editor_thumbnail($row['wr_content']); - // 파일테이블 행 삭제 - sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); + // 파일테이블 행 삭제 + sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); - $count_write++; - } - else - { - // 코멘트 포인트 삭제 - if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글')) - insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제"); + $count_write++; + } else { + // 코멘트 포인트 삭제 + if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글')) + insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제"); - $count_comment++; - } + $count_comment++; + } } // 게시글 삭제 @@ -120,8 +117,8 @@ sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr $notice_array = explode("\n", trim($board['bo_notice'])); $bo_notice = ""; for ($k=0; $k 0 || $count_comment > 0) - sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); + sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); -@include_once($board_skin_path.'/delete.tail.skin.php'); +@include_once($board_skin_path . '/delete.tail.skin.php'); delete_cache_latest($bo_table); -goto_url('./board.php?bo_table='.$bo_table.'&page='.$page.$qstr); -?> +goto_url('./board.php?bo_table=' . $bo_table . '&page=' . $page . $qstr); diff --git a/AvocadoEdition_Light/bbs/delete_all.php b/AvocadoEdition_Light/bbs/delete_all.php index 178b260..c6ea08a 100644 --- a/AvocadoEdition_Light/bbs/delete_all.php +++ b/AvocadoEdition_Light/bbs/delete_all.php @@ -1,160 +1,151 @@ (G5_IS_MOBILE ? $board['bo_mobile_page_rows'] : $board['bo_page_rows'])) - alert('올바른 방법으로 이용해 주십시오.'); +if ($chk_count > (G5_IS_MOBILE ? $board['bo_mobile_page_rows'] : $board['bo_page_rows'])) + alert('올바른 방법으로 이용해 주십시오.'); // 사용자 코드 실행 -@include_once($board_skin_path.'/delete_all.skin.php'); +@include_once($board_skin_path . '/delete_all.skin.php'); // 거꾸로 읽는 이유는 답변글부터 삭제가 되어야 하기 때문임 -for ($i=$chk_count-1; $i>=0; $i--) -{ - $write = sql_fetch(" select * from $write_table where wr_id = '$tmp_array[$i]' "); +for ($i = $chk_count - 1; $i >= 0; $i--) { + $write = sql_fetch(" select * from $write_table where wr_id = '$tmp_array[$i]' "); - if ($is_admin == 'super') // 최고관리자 통과 + if ($is_admin == 'super') // 최고관리자 통과 + ; + else if ($is_admin == 'group') // 그룹관리자 + { + $mb = get_member($write['mb_id']); + if ($member['mb_id'] == $group['gr_admin']) // 자신이 관리하는 그룹인가? + { + if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 ; - else if ($is_admin == 'group') // 그룹관리자 - { - $mb = get_member($write['mb_id']); - if ($member['mb_id'] == $group['gr_admin']) // 자신이 관리하는 그룹인가? - { - if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - ; - else - continue; - } - else - continue; - } - else if ($is_admin == 'board') // 게시판관리자이면 - { - $mb = get_member($write['mb_id']); - if ($member['mb_id'] == $board['bo_admin']) // 자신이 관리하는 게시판인가? - if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - ; - else - continue; - else - continue; - } - else if ($member['mb_id'] && $member['mb_id'] == $write['mb_id']) // 자신의 글이라면 - { + else + continue; + } else + continue; + } else if ($is_admin == 'board') // 게시판관리자이면 + { + $mb = get_member($write['mb_id']); + if ($member['mb_id'] == $board['bo_admin']) // 자신이 관리하는 게시판인가? + if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 ; - } - else if ($wr_password && !$write['mb_id'] && check_password($wr_password, $write['wr_password'])) // 비밀번호가 같다면 - { - ; - } + else + continue; else - continue; // 나머지는 삭제 불가 + continue; + } else if ($member['mb_id'] && $member['mb_id'] == $write['mb_id']) // 자신의 글이라면 + { + ; + } else if ($wr_password && !$write['mb_id'] && check_password($wr_password, $write['wr_password'])) // 비밀번호가 같다면 + { + ; + } else + continue; // 나머지는 삭제 불가 - $len = strlen($write['wr_reply']); - if ($len < 0) $len = 0; - $reply = substr($write['wr_reply'], 0, $len); + $len = strlen($write['wr_reply']); + if ($len < 0) + $len = 0; + $reply = substr($write['wr_reply'], 0, $len); - // 원글만 구한다. - $sql = " select count(*) as cnt from $write_table + // 원글만 구한다. + $sql = " select count(*) as cnt from $write_table where wr_reply like '$reply%' and wr_id <> '{$write['wr_id']}' and wr_num = '{$write['wr_num']}' and wr_is_comment = 0 "; - $row = sql_fetch($sql); - if ($row['cnt']) - continue; + $row = sql_fetch($sql); + if ($row['cnt']) + continue; - // 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다. - //$sql = " select wr_id, mb_id, wr_comment from {$write_table} where wr_parent = '{$write['wr_id']}' order by wr_id "; - $sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id "; - $result = sql_query($sql); - while ($row = sql_fetch_array($result)) - { - // 원글이라면 - if (!$row['wr_is_comment']) - { - // 원글 포인트 삭제 - if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기')) - insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글 삭제"); + // 나라오름님 수정 : 원글과 코멘트수가 정상적으로 업데이트 되지 않는 오류를 잡아 주셨습니다. + //$sql = " select wr_id, mb_id, wr_comment from {$write_table} where wr_parent = '{$write['wr_id']}' order by wr_id "; + $sql = " select wr_id, mb_id, wr_is_comment, wr_content from $write_table where wr_parent = '{$write['wr_id']}' order by wr_id "; + $result = sql_query($sql); + while ($row = sql_fetch_array($result)) { + // 원글이라면 + if (!$row['wr_is_comment']) { + // 원글 포인트 삭제 + if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '쓰기')) + insert_point($row['mb_id'], $board['bo_write_point'] * (-1), "{$board['bo_subject']} {$row['wr_id']} 글 삭제"); - // 업로드된 파일이 있다면 - $sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "; - $result2 = sql_query($sql2); - while ($row2 = sql_fetch_array($result2)) { - // 파일삭제 - @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row2['bf_file']); + // 업로드된 파일이 있다면 + $sql2 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "; + $result2 = sql_query($sql2); + while ($row2 = sql_fetch_array($result2)) { + // 파일삭제 + @unlink(G5_DATA_PATH . '/file/' . $bo_table . '/' . $row2['bf_file']); - // 썸네일삭제 - if(preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { - delete_board_thumbnail($bo_table, $row2['bf_file']); - } - } - - // 에디터 썸네일 삭제 - delete_editor_thumbnail($row['wr_content']); - - // 파일테이블 행 삭제 - sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); - - $count_write++; + // 썸네일삭제 + if (preg_match("/\.({$config['cf_image_extension']})$/i", $row2['bf_file'])) { + delete_board_thumbnail($bo_table, $row2['bf_file']); } - else - { - // 코멘트 포인트 삭제 - if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글')) - insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제"); + } - $count_comment++; - } + // 에디터 썸네일 삭제 + delete_editor_thumbnail($row['wr_content']); + + // 파일테이블 행 삭제 + sql_query(" delete from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row['wr_id']}' "); + + $count_write++; + } else { + // 코멘트 포인트 삭제 + if (!delete_point($row['mb_id'], $bo_table, $row['wr_id'], '댓글')) + insert_point($row['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_id']}-{$row['wr_id']} 댓글삭제"); + + $count_comment++; } + } - // 게시글 삭제 - sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' "); + // 게시글 삭제 + sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' "); - // 최근게시물 삭제 - sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' "); + // 최근게시물 삭제 + sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' "); - // 스크랩 삭제 - sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' "); + // 스크랩 삭제 + sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' "); - /* - // 공지사항 삭제 - $notice_array = explode(',', trim($board['bo_notice'])); - $bo_notice = ""; - for ($k=0; $k 0 || $count_comment > 0) - sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); + sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); // 4.11 -@include_once($board_skin_path.'/delete_all.tail.skin.php'); +@include_once($board_skin_path . '/delete_all.tail.skin.php'); delete_cache_latest($bo_table); -goto_url('./board.php?bo_table='.$bo_table.'&page='.$page.$qstr); -?> +goto_url('./board.php?bo_table=' . $bo_table . '&page=' . $page . $qstr); diff --git a/AvocadoEdition_Light/bbs/delete_comment.php b/AvocadoEdition_Light/bbs/delete_comment.php index ac656e3..312d653 100644 --- a/AvocadoEdition_Light/bbs/delete_comment.php +++ b/AvocadoEdition_Light/bbs/delete_comment.php @@ -2,50 +2,51 @@ // 코멘트 삭제 include_once('./_common.php'); -$delete_comment_token = get_session('ss_delete_comment_'.$comment_id.'_token'); -set_session('ss_delete_comment_'.$comment_id.'_token', ''); +$delete_comment_token = get_session('ss_delete_comment_' . $comment_id . '_token'); +set_session('ss_delete_comment_' . $comment_id . '_token', ''); if (!($token && $delete_comment_token == $token)) - alert('토큰 에러로 삭제 불가합니다.'); + alert('토큰 에러로 삭제 불가합니다.'); // 4.1 -@include_once($board_skin_path.'/delete_comment.head.skin.php'); +@include_once($board_skin_path . '/delete_comment.head.skin.php'); $write = sql_fetch(" select * from {$write_table} where wr_id = '{$comment_id}' "); if (!$write['wr_id'] || !$write['wr_is_comment']) - alert('등록된 코멘트가 없거나 코멘트 글이 아닙니다.'); + alert('등록된 코멘트가 없거나 코멘트 글이 아닙니다.'); if ($is_admin == 'super') // 최고관리자 통과 - ; + ; else if ($is_admin == 'group') { // 그룹관리자 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] == $group['gr_admin']) { // 자신이 관리하는 그룹인가? - if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - ; - else - alert('그룹관리자의 권한보다 높은 회원의 코멘트이므로 삭제할 수 없습니다.'); - } else - alert('자신이 관리하는 그룹의 게시판이 아니므로 코멘트를 삭제할 수 없습니다.'); + $mb = get_member($write['mb_id']); + if ($member['mb_id'] == $group['gr_admin']) { // 자신이 관리하는 그룹인가? + if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + ; + else + alert('그룹관리자의 권한보다 높은 회원의 코멘트이므로 삭제할 수 없습니다.'); + } else + alert('자신이 관리하는 그룹의 게시판이 아니므로 코멘트를 삭제할 수 없습니다.'); } else if ($is_admin == 'board') { // 게시판관리자이면 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가? - if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - ; - else - alert('게시판관리자의 권한보다 높은 회원의 코멘트이므로 삭제할 수 없습니다.'); - } else - alert('자신이 관리하는 게시판이 아니므로 코멘트를 삭제할 수 없습니다.'); + $mb = get_member($write['mb_id']); + if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가? + if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + ; + else + alert('게시판관리자의 권한보다 높은 회원의 코멘트이므로 삭제할 수 없습니다.'); + } else + alert('자신이 관리하는 게시판이 아니므로 코멘트를 삭제할 수 없습니다.'); } else if ($member['mb_id']) { - if ($member['mb_id'] != $write['mb_id']) - alert('자신의 글이 아니므로 삭제할 수 없습니다.'); + if ($member['mb_id'] != $write['mb_id']) + alert('자신의 글이 아니므로 삭제할 수 없습니다.'); } else { - if (!check_password($wr_password, $write['wr_password'])) - alert('비밀번호가 틀립니다.'); + if (!check_password($wr_password, $write['wr_password'])) + alert('비밀번호가 틀립니다.'); } $len = strlen($write['wr_comment_reply']); -if ($len < 0) $len = 0; +if ($len < 0) + $len = 0; $comment_reply = substr($write['wr_comment_reply'], 0, $len); $sql = " select count(*) as cnt from {$write_table} @@ -56,11 +57,11 @@ $sql = " select count(*) as cnt from {$write_table} and wr_is_comment = 1 "; $row = sql_fetch($sql); if ($row['cnt'] && !$is_admin) - alert('이 코멘트와 관련된 답변코멘트가 존재하므로 삭제 할 수 없습니다.'); + alert('이 코멘트와 관련된 답변코멘트가 존재하므로 삭제 할 수 없습니다.'); // 코멘트 포인트 삭제 if (!delete_point($write['mb_id'], $bo_table, $comment_id, '댓글')) - insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 댓글삭제"); + insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 댓글삭제"); // 코멘트 삭제 sql_query(" delete from {$write_table} where wr_id = '{$comment_id}' "); @@ -79,10 +80,9 @@ sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment sql_query(" delete from {$g5['board_new_table']} where bo_table = '{$bo_table}' and wr_id = '{$comment_id}' "); // 사용자 코드 실행 -@include_once($board_skin_path.'/delete_comment.skin.php'); -@include_once($board_skin_path.'/delete_comment.tail.skin.php'); +@include_once($board_skin_path . '/delete_comment.skin.php'); +@include_once($board_skin_path . '/delete_comment.tail.skin.php'); delete_cache_latest($bo_table); -goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$write['wr_parent'].'&page='.$page. $qstr); -?> +goto_url('./board.php?bo_table=' . $bo_table . '&wr_id=' . $write['wr_parent'] . '&page=' . $page . $qstr); diff --git a/AvocadoEdition_Light/bbs/download.php b/AvocadoEdition_Light/bbs/download.php index 977f176..97fc7af 100644 --- a/AvocadoEdition_Light/bbs/download.php +++ b/AvocadoEdition_Light/bbs/download.php @@ -4,93 +4,92 @@ include_once('./_common.php'); // clean the output buffer ob_end_clean(); -$no = (int)$no; +$no = (int) $no; -@include_once($board_skin_path.'/download.head.skin.php'); +@include_once($board_skin_path . '/download.head.skin.php'); // 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생 // 다른곳에서 링크 거는것을 방지하기 위한 코드 -if (!get_session('ss_view_'.$bo_table.'_'.$wr_id)) - alert('잘못된 접근입니다.'); +if (!get_session('ss_view_' . $bo_table . '_' . $wr_id)) + alert('잘못된 접근입니다.'); // 다운로드 차감일 때 비회원은 다운로드 불가 -if($board['bo_download_point'] < 0 && $is_guest) - alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.'&'.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id)); +if ($board['bo_download_point'] < 0 && $is_guest) + alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL . '/login.php?wr_id=' . $wr_id . '&' . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id)); $sql = " select bf_source, bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' "; $file = sql_fetch($sql); if (!$file['bf_file']) - alert_close('파일 정보가 존재하지 않습니다.'); + alert_close('파일 정보가 존재하지 않습니다.'); // JavaScript 불가일 때 -if($js != 'on' && $board['bo_download_point'] < 0) { - $msg = $file['bf_source'].' 파일을 다운로드 하시면 포인트가 차감('.number_format($board['bo_download_point']).'점)됩니다.\\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\\n그래도 다운로드 하시겠습니까?'; - $url1 = G5_BBS_URL.'/download.php?'.clean_query_string($_SERVER['QUERY_STRING']).'&js=on'; - $url2 = clean_xss_tags($_SERVER['HTTP_REFERER']); +if ($js != 'on' && $board['bo_download_point'] < 0) { + $msg = $file['bf_source'] . ' 파일을 다운로드 하시면 포인트가 차감(' . number_format($board['bo_download_point']) . '점)됩니다.\\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\\n그래도 다운로드 하시겠습니까?'; + $url1 = G5_BBS_URL . '/download.php?' . clean_query_string($_SERVER['QUERY_STRING']) . '&js=on'; + $url2 = clean_xss_tags($_SERVER['HTTP_REFERER']); - //$url1 = 확인link, $url2=취소link - // 특정주소로 이동시키려면 $url3 이용 - confirm($msg, $url1, $url2); + //$url1 = 확인link, $url2=취소link + // 특정주소로 이동시키려면 $url3 이용 + confirm($msg, $url1, $url2); } if ($member['mb_level'] < $board['bo_download_level']) { - $alert_msg = '다운로드 권한이 없습니다.'; - if ($member['mb_id']) - alert($alert_msg); - else - alert($alert_msg.'\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.'&'.$qstr.'&url='.urlencode(G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id)); + $alert_msg = '다운로드 권한이 없습니다.'; + if ($member['mb_id']) + alert($alert_msg); + else + alert($alert_msg . '\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL . '/login.php?wr_id=' . $wr_id . '&' . $qstr . '&url=' . urlencode(G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id)); } -$filepath = G5_DATA_PATH.'/file/'.$bo_table.'/'.$file['bf_file']; +$filepath = G5_DATA_PATH . '/file/' . $bo_table . '/' . $file['bf_file']; $filepath = addslashes($filepath); if (!is_file($filepath) || !file_exists($filepath)) - alert('파일이 존재하지 않습니다.'); + alert('파일이 존재하지 않습니다.'); // 사용자 코드 실행 -@include_once($board_skin_path.'/download.skin.php'); +@include_once($board_skin_path . '/download.skin.php'); // 이미 다운로드 받은 파일인지를 검사한 후 게시물당 한번만 포인트를 차감하도록 수정 -$ss_name = 'ss_down_'.$bo_table.'_'.$wr_id; -if (!get_session($ss_name)) -{ - // 자신의 글이라면 통과 - // 관리자인 경우 통과 - if (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin) - ; - else if ($board['bo_download_level'] >= 1) // 회원이상 다운로드가 가능하다면 - { - // 다운로드 포인트가 음수이고 회원의 포인트가 0 이거나 작다면 - if ($member['mb_point'] + $board['bo_download_point'] < 0) - alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 다운로드('.number_format($board['bo_download_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 다운로드 해 주십시오.'); +$ss_name = 'ss_down_' . $bo_table . '_' . $wr_id; +if (!get_session($ss_name)) { + // 자신의 글이라면 통과 + // 관리자인 경우 통과 + if (($write['mb_id'] && $write['mb_id'] == $member['mb_id']) || $is_admin) + ; + else if ($board['bo_download_level'] >= 1) // 회원이상 다운로드가 가능하다면 + { + // 다운로드 포인트가 음수이고 회원의 포인트가 0 이거나 작다면 + if ($member['mb_point'] + $board['bo_download_point'] < 0) + alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 다운로드(' . number_format($board['bo_download_point']) . ')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 다운로드 해 주십시오.'); - // 게시물당 한번만 차감하도록 수정 - insert_point($member['mb_id'], $board['bo_download_point'], "{$board['bo_subject']} $wr_id 파일 다운로드", $bo_table, $wr_id, "다운로드"); - } + // 게시물당 한번만 차감하도록 수정 + insert_point($member['mb_id'], $board['bo_download_point'], "{$board['bo_subject']} $wr_id 파일 다운로드", $bo_table, $wr_id, "다운로드"); + } - // 다운로드 카운트 증가 - $sql = " update {$g5['board_file_table']} set bf_download = bf_download + 1 where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' "; - sql_query($sql); + // 다운로드 카운트 증가 + $sql = " update {$g5['board_file_table']} set bf_download = bf_download + 1 where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$no' "; + sql_query($sql); - set_session($ss_name, TRUE); + set_session($ss_name, TRUE); } -$g5['title'] = '다운로드 > '.conv_subject($write['wr_subject'], 255); +$g5['title'] = '다운로드 > ' . conv_subject($write['wr_subject'], 255); //$original = urlencode($file['bf_source']); $original = iconv('utf-8', 'euc-kr', $file['bf_source']); // SIR 잉끼님 제안코드 -@include_once($board_skin_path.'/download.tail.skin.php'); +@include_once($board_skin_path . '/download.tail.skin.php'); -if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) { - header("content-type: doesn/matter"); - header("content-length: ".filesize("$filepath")); - header("content-disposition: attachment; filename=\"$original\""); - header("content-transfer-encoding: binary"); +if (preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) { + header("content-type: doesn/matter"); + header("content-length: " . filesize("$filepath")); + header("content-disposition: attachment; filename=\"$original\""); + header("content-transfer-encoding: binary"); } else { - header("content-type: file/unknown"); - header("content-length: ".filesize("$filepath")); - header("content-disposition: attachment; filename=\"$original\""); - header("content-description: php generated data"); + header("content-type: file/unknown"); + header("content-length: " . filesize("$filepath")); + header("content-disposition: attachment; filename=\"$original\""); + header("content-description: php generated data"); } header("pragma: no-cache"); header("expires: 0"); @@ -106,17 +105,16 @@ $fp = fopen($filepath, 'rb'); $download_rate = 10; -while(!feof($fp)) { - //echo fread($fp, 100*1024); - /* - echo fread($fp, 100*1024); - flush(); - */ +while (!feof($fp)) { + //echo fread($fp, 100*1024); + /* + echo fread($fp, 100*1024); + flush(); + */ - print fread($fp, round($download_rate * 1024)); - flush(); - usleep(1000); + print fread($fp, round($download_rate * 1024)); + flush(); + usleep(1000); } -fclose ($fp); +fclose($fp); flush(); -?> diff --git a/AvocadoEdition_Light/bbs/email_certify.php b/AvocadoEdition_Light/bbs/email_certify.php index 80b4bf0..6e809e0 100644 --- a/AvocadoEdition_Light/bbs/email_certify.php +++ b/AvocadoEdition_Light/bbs/email_certify.php @@ -1,30 +1,25 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/email_stop.php b/AvocadoEdition_Light/bbs/email_stop.php index 3635bb3..58caaeb 100644 --- a/AvocadoEdition_Light/bbs/email_stop.php +++ b/AvocadoEdition_Light/bbs/email_stop.php @@ -4,16 +4,15 @@ include_once('./_common.php'); $sql = " select mb_id, mb_email, mb_datetime from {$g5['member_table']} where mb_id = '{$mb_id}' "; $row = sql_fetch($sql); if (!$row['mb_id']) - alert('존재하는 회원이 아닙니다.', G5_URL); + alert('존재하는 회원이 아닙니다.', G5_URL); if ($mb_md5) { - $tmp_md5 = md5($row['mb_id'].$row['mb_email'].$row['mb_datetime']); - if ($mb_md5 == $tmp_md5) { - sql_query(" update {$g5['member_table']} set mb_mailling = 0 where mb_id = '{$mb_id}' "); + $tmp_md5 = md5($row['mb_id'] . $row['mb_email'] . $row['mb_datetime']); + if ($mb_md5 == $tmp_md5) { + sql_query(" update {$g5['member_table']} set mb_mailling = 0 where mb_id = '{$mb_id}' "); - alert('정보메일을 보내지 않도록 수신거부 하였습니다.', G5_URL); - } + alert('정보메일을 보내지 않도록 수신거부 하였습니다.', G5_URL); + } } alert('제대로 된 값이 넘어오지 않았습니다.', G5_URL); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/faq.php b/AvocadoEdition_Light/bbs/faq.php index 86a31e2..456d205 100644 --- a/AvocadoEdition_Light/bbs/faq.php +++ b/AvocadoEdition_Light/bbs/faq.php @@ -2,97 +2,98 @@ include_once('./_common.php'); //dbconfig파일에 $g5['faq_table'] , $g5['faq_master_table'] 배열변수가 있는지 체크 -if( !isset($g5['faq_table']) || !isset($g5['faq_master_table']) ){ - die('관리자 모드에서 게시판관리->FAQ관리를 먼저 확인해 주세요.'); +if (!isset($g5['faq_table']) || !isset($g5['faq_master_table'])) { + die('관리자 모드에서 게시판관리->FAQ관리를 먼저 확인해 주세요.'); } // FAQ MASTER $faq_master_list = array(); $sql = " select * from {$g5['faq_master_table']} order by fm_order,fm_id "; $result = sql_query($sql); -while ($row=sql_fetch_array($result)) -{ - $key = $row['fm_id']; - if (!$fm_id) $fm_id = $key; - $faq_master_list[$key] = $row; +while ($row = sql_fetch_array($result)) { + $key = $row['fm_id']; + if (!$fm_id) + $fm_id = $key; + $faq_master_list[$key] = $row; } -if ($fm_id){ - $qstr .= '&fm_id=' . $fm_id; // 마스터faq key_id +if ($fm_id) { + $qstr .= '&fm_id=' . $fm_id; // 마스터faq key_id } $fm = $faq_master_list[$fm_id]; if (!$fm['fm_id']) - alert('등록된 내용이 없습니다.'); + alert('등록된 내용이 없습니다.'); $g5['title'] = $fm['fm_subject']; -$skin_file = $faq_skin_path.'/list.skin.php'; +$skin_file = $faq_skin_path . '/list.skin.php'; include_once('./_head.php'); -if(is_file($skin_file)) { - $admin_href = ''; - $himg_src = ''; - $timg_src = ''; - if($is_admin) - $admin_href = G5_ADMIN_URL.'/faqmasterform.php?w=u&fm_id='.$fm_id; +if (is_file($skin_file)) { + $admin_href = ''; + $himg_src = ''; + $timg_src = ''; + if ($is_admin) + $admin_href = G5_ADMIN_URL . '/faqmasterform.php?w=u&fm_id=' . $fm_id; - if(!G5_IS_MOBILE) { - $himg = G5_DATA_PATH.'/faq/'.$fm_id.'_h'; - if (is_file($himg)){ - $himg_src = G5_DATA_URL.'/faq/'.$fm_id.'_h'; - } - - $timg = G5_DATA_PATH.'/faq/'.$fm_id.'_t'; - if (is_file($timg)){ - $timg_src = G5_DATA_URL.'/faq/'.$fm_id.'_t'; - } + if (!G5_IS_MOBILE) { + $himg = G5_DATA_PATH . '/faq/' . $fm_id . '_h'; + if (is_file($himg)) { + $himg_src = G5_DATA_URL . '/faq/' . $fm_id . '_h'; } - $category_href = G5_BBS_URL.'/faq.php'; - $category_stx = ''; - $faq_list = array(); - - $stx = trim($stx); - $sql_search = ''; - - if($stx) { - $sql_search = " and ( INSTR(fa_subject, '$stx') > 0 or INSTR(fa_content, '$stx') > 0 ) "; + $timg = G5_DATA_PATH . '/faq/' . $fm_id . '_t'; + if (is_file($timg)) { + $timg_src = G5_DATA_URL . '/faq/' . $fm_id . '_t'; } + } - if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) + $category_href = G5_BBS_URL . '/faq.php'; + $category_stx = ''; + $faq_list = array(); - $page_rows = G5_IS_MOBILE ? $config['cf_mobile_page_rows'] : $config['cf_page_rows']; + $stx = trim($stx); + $sql_search = ''; - $sql = " select count(*) as cnt + if ($stx) { + $sql_search = " and ( INSTR(fa_subject, '$stx') > 0 or INSTR(fa_content, '$stx') > 0 ) "; + } + + if ($page < 1) { + $page = 1; + } // 페이지가 없으면 첫 페이지 (1 페이지) + + $page_rows = G5_IS_MOBILE ? $config['cf_mobile_page_rows'] : $config['cf_page_rows']; + + $sql = " select count(*) as cnt from {$g5['faq_table']} where fm_id = '$fm_id' $sql_search "; - $total = sql_fetch($sql); - $total_count = $total['cnt']; + $total = sql_fetch($sql); + $total_count = $total['cnt']; - $total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 - $from_record = ($page - 1) * $page_rows; // 시작 열을 구함 + $total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 + $from_record = ($page - 1) * $page_rows; // 시작 열을 구함 - $sql = " select * + $sql = " select * from {$g5['faq_table']} where fm_id = '$fm_id' $sql_search order by fa_order , fa_id limit $from_record, $page_rows "; - $result = sql_query($sql); - for ($i=0;$row=sql_fetch_array($result);$i++){ - $faq_list[] = $row; - if($stx) { - $faq_list[$i]['fa_subject'] = search_font($stx, conv_content($faq_list[$i]['fa_subject'], 1)); - $faq_list[$i]['fa_content'] = search_font($stx, conv_content($faq_list[$i]['fa_content'], 1)); - } + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + $faq_list[] = $row; + if ($stx) { + $faq_list[$i]['fa_subject'] = search_font($stx, conv_content($faq_list[$i]['fa_subject'], 1)); + $faq_list[$i]['fa_content'] = search_font($stx, conv_content($faq_list[$i]['fa_content'], 1)); } - include_once($skin_file); + } + include_once($skin_file); } else { - echo '

    '.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.

    '; + echo '

    ' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.

    '; } include_once('./_tail.php'); -?> diff --git a/AvocadoEdition_Light/bbs/formmail.php b/AvocadoEdition_Light/bbs/formmail.php index fe099d2..59416c4 100644 --- a/AvocadoEdition_Light/bbs/formmail.php +++ b/AvocadoEdition_Light/bbs/formmail.php @@ -1,54 +1,52 @@ 3) - alert_close('한번 접속후 일정수의 메일만 발송할 수 있습니다.\\n\\n계속해서 메일을 보내시려면 다시 로그인 또는 접속하여 주십시오.'); + alert_close('한번 접속후 일정수의 메일만 발송할 수 있습니다.\\n\\n계속해서 메일을 보내시려면 다시 로그인 또는 접속하여 주십시오.'); $g5['title'] = '메일 쓰기'; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); $email_enc = new str_encrypt(); $email_dec = $email_enc->decrypt($email); $email = get_email_address($email_dec); -if(!$email) - alert_close('이메일이 올바르지 않습니다.'); +if (!$email) + alert_close('이메일이 올바르지 않습니다.'); $email = $email_enc->encrypt($email); if (!$name) - $name = $email; + $name = $email; else - $name = get_text(stripslashes($name), true); + $name = get_text(stripslashes($name), true); if (!isset($type)) - $type = 0; + $type = 0; $type_checked[0] = $type_checked[1] = $type_checked[2] = ""; $type_checked[$type] = 'checked'; -include_once($member_skin_path.'/formmail.skin.php'); +include_once($member_skin_path . '/formmail.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/formmail_send.php b/AvocadoEdition_Light/bbs/formmail_send.php index 0902094..1869a8c 100644 --- a/AvocadoEdition_Light/bbs/formmail_send.php +++ b/AvocadoEdition_Light/bbs/formmail_send.php @@ -1,60 +1,58 @@ decrypt($to); if (substr_count($to, "@") > 1) - alert_close('한번에 한사람에게만 메일을 발송할 수 있습니다.'); + alert_close('한번에 한사람에게만 메일을 발송할 수 있습니다.'); if (!chk_captcha()) { - alert('자동등록방지 숫자가 틀렸습니다.'); + alert('자동등록방지 숫자가 틀렸습니다.'); } $file = array(); -for ($i=1; $i<=$attach; $i++) { - if ($_FILES['file'.$i]['name']) - $file[] = attach_file($_FILES['file'.$i]['name'], $_FILES['file'.$i]['tmp_name']); +for ($i = 1; $i <= $attach; $i++) { + if ($_FILES['file' . $i]['name']) + $file[] = attach_file($_FILES['file' . $i]['name'], $_FILES['file' . $i]['tmp_name']); } $content = stripslashes($content); if ($type == 2) { - $type = 1; - $content = str_replace("\n", "
    ", $content); + $type = 1; + $content = str_replace("\n", "
    ", $content); } // html 이면 if ($type) { - $current_url = G5_URL; - $mail_content = '메일보내기'.$content.''; -} -else - $mail_content = $content; + $current_url = G5_URL; + $mail_content = '메일보내기' . $content . ''; +} else + $mail_content = $content; mailer($fnick, $fmail, $to, $subject, $mail_content, $type, $file); // 임시 첨부파일 삭제 -if(!empty($file)) { - foreach($file as $f) { - @unlink($f['path']); - } +if (!empty($file)) { + foreach ($file as $f) { + @unlink($f['path']); + } } //$html_title = $tmp_to . "님께 메일발송"; $html_title = '메일 발송중'; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); alert_close('메일을 정상적으로 발송하였습니다.'); -include_once(G5_PATH.'/tail.sub.php'); -?> \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/good.php b/AvocadoEdition_Light/bbs/good.php index d1714c9..b98deba 100644 --- a/AvocadoEdition_Light/bbs/good.php +++ b/AvocadoEdition_Light/bbs/good.php @@ -1,155 +1,144 @@ \ No newline at end of file +@include_once($board_skin_path . '/good.tail.skin.php'); diff --git a/AvocadoEdition_Light/bbs/group.php b/AvocadoEdition_Light/bbs/group.php index 34ef08d..9523bcc 100644 --- a/AvocadoEdition_Light/bbs/group.php +++ b/AvocadoEdition_Light/bbs/group.php @@ -1,26 +1,26 @@ @@ -32,27 +32,27 @@ $sql = " select bo_table, bo_subject where gr_id = '{$gr_id}' and bo_list_level <= '{$member['mb_level']}' and bo_device <> 'mobile' "; -if(!$is_admin) - $sql .= " and bo_use_cert = '' "; +if (!$is_admin) + $sql .= " and bo_use_cert = '' "; $sql .= " order by bo_order "; $result = sql_query($sql); -for ($i=0; $row=sql_fetch_array($result); $i++) { +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $lt_style = ""; + if ($i % 2 == 1) + $lt_style = "margin-left:20px"; + else $lt_style = ""; - if ($i%2==1) $lt_style = "margin-left:20px"; - else $lt_style = ""; -?> -
    + ?> +
    -
    - + - diff --git a/AvocadoEdition_Light/bbs/index.php b/AvocadoEdition_Light/bbs/index.php index d214256..323d73c 100644 --- a/AvocadoEdition_Light/bbs/index.php +++ b/AvocadoEdition_Light/bbs/index.php @@ -6,34 +6,33 @@ $list = array(); $side = array(); $ch_list = array(); -if($config['cf_side_title']) { - $side_result = sql_query("select * from {$g5['side_table']}"); - for($i=0; $si = sql_fetch_array($side_result); $i++) { - $list[] = get_character_list($si['si_id']); - $side[] = $si; - } -} +if ($config['cf_side_title']) { + $side_result = sql_query("select * from {$g5['side_table']}"); + for ($i = 0; $si = sql_fetch_array($side_result); $i++) { + $list[] = get_character_list($si['si_id']); + $side[] = $si; + } +} -if(!$config['cf_side_title'] || count($side) < 2) { - $list = array(); - $side = array(); +if (!$config['cf_side_title'] || count($side) < 2) { + $list = array(); + $side = array(); - $list[] = get_character_list(); - $side[] = ''; + $list[] = get_character_list(); + $side[] = ''; } $g5['title'] = "멤버란"; -include_once(G5_PATH.'/head.php'); +include_once(G5_PATH . '/head.php'); -if(defined('G5_THEME_PATH') && is_file(G5_THEME_PATH."/member/list.skin.php")) { - include(G5_THEME_PATH."/member/list.skin.php"); +if (defined('G5_THEME_PATH') && is_file(G5_THEME_PATH . "/member/list.skin.php")) { + include(G5_THEME_PATH . "/member/list.skin.php"); } else { - include(G5_PATH."/member/skin/list.skin.php"); + include(G5_PATH . "/member/skin/list.skin.php"); } unset($ch); unset($list); -include_once(G5_PATH.'/tail.php'); -?> +include_once(G5_PATH . '/tail.php'); diff --git a/AvocadoEdition_Light/bbs/link.php b/AvocadoEdition_Light/bbs/link.php index e74536c..d49a98d 100644 --- a/AvocadoEdition_Light/bbs/link.php +++ b/AvocadoEdition_Light/bbs/link.php @@ -1,27 +1,25 @@ \ No newline at end of file +goto_url(set_http($write['wr_link' . $no])); diff --git a/AvocadoEdition_Light/bbs/list.mmb.php b/AvocadoEdition_Light/bbs/list.mmb.php index 8c798e0..b803f7d 100644 --- a/AvocadoEdition_Light/bbs/list.mmb.php +++ b/AvocadoEdition_Light/bbs/list.mmb.php @@ -1,73 +1,78 @@ '; + $categories = explode('|', $board['bo_category_list']); // 구분자가 , 로 되어 있음 + for ($i = 0; $i < count($categories); $i++) { + $category = trim($categories[$i]); + if ($category == '') + continue; + $category_option .= '
  • '; + } } $sop = strtolower($sop); if ($sop != 'and' && $sop != 'or') - $sop = 'and'; + $sop = 'and'; // 분류 선택 또는 검색어가 있다면 $stx = trim($stx); if ($sca || $stx) { - // 검색구문 호출 기능 커스텀한 것으로 재호출 - $sql_search = get_sql_search_mmb($sca, $sfl, $stx, $sop, $single); + // 검색구문 호출 기능 커스텀한 것으로 재호출 + $sql_search = get_sql_search_mmb($sca, $sfl, $stx, $sop, $single); - // 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용) - $sql = " select MIN(wr_num) as min_wr_num from {$write_table} "; - $row = sql_fetch($sql); - $min_spt = (int)$row['min_wr_num']; + // 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용) + $sql = " select MIN(wr_num) as min_wr_num from {$write_table} "; + $row = sql_fetch($sql); + $min_spt = (int) $row['min_wr_num']; - if (!$spt) $spt = $min_spt; + if (!$spt) + $spt = $min_spt; - $sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) "; + $sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) "; - // 원글만 얻는다. (코멘트의 내용도 검색하기 위함) - // 라엘님 제안 코드로 대체 http://sir.co.kr/bbs/board.php?bo_table=g5_bug&wr_id=2922 - $sql = " SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM {$write_table} WHERE {$sql_search} "; - $row = sql_fetch($sql); - $total_count = $row['cnt']; - /* - $sql = " select distinct wr_parent from {$write_table} where {$sql_search} "; - $result = sql_query($sql); - $total_count = mysql_num_rows($result); - */ + // 원글만 얻는다. (코멘트의 내용도 검색하기 위함) + // 라엘님 제안 코드로 대체 http://sir.co.kr/bbs/board.php?bo_table=g5_bug&wr_id=2922 + $sql = " SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM {$write_table} WHERE {$sql_search} "; + $row = sql_fetch($sql); + $total_count = $row['cnt']; + /* + $sql = " select distinct wr_parent from {$write_table} where {$sql_search} "; + $result = sql_query($sql); + $total_count = mysql_num_rows($result); + */ } else { - $sql_search = ""; - $total_count = $board['bo_count_write']; + $sql_search = ""; + $total_count = $board['bo_count_write']; } -if(G5_IS_MOBILE) { - $page_rows = 5; - $list_page_rows = 5; +if (G5_IS_MOBILE) { + $page_rows = 5; + $list_page_rows = 5; } else { - $page_rows = $board['bo_page_rows']; - $list_page_rows = $board['bo_page_rows']; + $page_rows = $board['bo_page_rows']; + $list_page_rows = $board['bo_page_rows']; } -if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) +if ($page < 1) { + $page = 1; +} // 페이지가 없으면 첫 페이지 (1 페이지) // 년도 2자리 $today2 = G5_TIME_YMD; @@ -79,171 +84,171 @@ $notice_array = array(); // 공지 처리 if (!$sca && !$stx) { - $arr_notice = explode(',', trim($board['bo_notice'])); - $from_notice_idx = ($page - 1) * $page_rows; - if($from_notice_idx < 0) - $from_notice_idx = 0; - $board_notice_count = count($arr_notice); + $arr_notice = explode(',', trim($board['bo_notice'])); + $from_notice_idx = ($page - 1) * $page_rows; + if ($from_notice_idx < 0) + $from_notice_idx = 0; + $board_notice_count = count($arr_notice); - for ($k=0; $k<$board_notice_count; $k++) { - if (trim($arr_notice[$k]) == '') continue; + for ($k = 0; $k < $board_notice_count; $k++) { + if (trim($arr_notice[$k]) == '') + continue; - $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' "); + $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' "); - if (!$row['wr_id']) continue; + if (!$row['wr_id']) + continue; - $notice_array[] = $row['wr_id']; + $notice_array[] = $row['wr_id']; - if($k < $from_notice_idx) continue; + if ($k < $from_notice_idx) + continue; - $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); - $list[$i]['is_notice'] = true; + $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); + $list[$i]['is_notice'] = true; - $i++; - $notice_count++; + $i++; + $notice_count++; - if($notice_count >= $list_page_rows) - break; - } + if ($notice_count >= $list_page_rows) + break; + } } -$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 +$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 $from_record = ($page - 1) * $page_rows; // 시작 열을 구함 // 공지글이 있으면 변수에 반영 -if(!empty($notice_array)) { - $from_record -= count($notice_array); +if (!empty($notice_array)) { + $from_record -= count($notice_array); - if($from_record < 0) - $from_record = 0; + if ($from_record < 0) + $from_record = 0; - if($notice_count > 0) - $page_rows -= $notice_count; + if ($notice_count > 0) + $page_rows -= $notice_count; - if($page_rows < 0) - $page_rows = $list_page_rows; + if ($page_rows < 0) + $page_rows = $list_page_rows; } // 관리자라면 CheckBox 보임 $is_checkbox = false; if ($is_member && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id'])) - $is_checkbox = true; + $is_checkbox = true; // 정렬에 사용하는 QUERY_STRING -$qstr2 = 'bo_table='.$bo_table.'&sop='.$sop; +$qstr2 = 'bo_table=' . $bo_table . '&sop=' . $sop; // 0 으로 나눌시 오류를 방지하기 위하여 값이 없으면 1 로 설정 $bo_gallery_cols = $board['bo_gallery_cols'] ? $board['bo_gallery_cols'] : 1; -$td_width = (int)(100 / $bo_gallery_cols); +$td_width = (int) (100 / $bo_gallery_cols); // 정렬 // 인덱스 필드가 아니면 정렬에 사용하지 않음 //if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) { if (!$sst) { - if ($board['bo_sort_field']) { - $sst = $board['bo_sort_field']; - } else { - $sst = "wr_num, wr_reply"; - $sod = ""; - } + if ($board['bo_sort_field']) { + $sst = $board['bo_sort_field']; + } else { + $sst = "wr_num, wr_reply"; + $sod = ""; + } } else { - // 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16) - // 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요. - // $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; - $sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; + // 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16) + // 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요. + // $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; + $sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; } -if(!$sst) - $sst = "wr_num, wr_reply"; +if (!$sst) + $sst = "wr_num, wr_reply"; if ($sst) { - $sql_order = " order by {$sst} {$sod} "; + $sql_order = " order by {$sst} {$sod} "; } if ($sca || $stx) { - $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows "; + $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows "; } else { - $sql = " select * from {$write_table} where wr_is_comment = 0 "; - if(!empty($notice_array)) - $sql .= " and wr_id not in (".implode(', ', $notice_array).") "; - $sql .= " {$sql_order} limit {$from_record}, $page_rows "; + $sql = " select * from {$write_table} where wr_is_comment = 0 "; + if (!empty($notice_array)) + $sql .= " and wr_id not in (" . implode(', ', $notice_array) . ") "; + $sql .= " {$sql_order} limit {$from_record}, $page_rows "; } // 페이지의 공지개수가 목록수 보다 작을 때만 실행 -if($page_rows > 0) { - $result = sql_query($sql); +if ($page_rows > 0) { + $result = sql_query($sql); - $k = 0; + $k = 0; - while ($row = sql_fetch_array($result)) - { - // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다 - if ($sca || $stx) - $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' "); + while ($row = sql_fetch_array($result)) { + // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다 + if ($sca || $stx) + $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' "); - $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); - if (strstr($sfl, 'subject')) { - $list[$i]['subject'] = search_font($stx, $list[$i]['subject']); - } - $list[$i]['is_notice'] = false; - $list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count; - $list[$i]['num'] = $list_num - $k; + $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); + if (strstr($sfl, 'subject')) { + $list[$i]['subject'] = search_font($stx, $list[$i]['subject']); + } + $list[$i]['is_notice'] = false; + $list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count; + $list[$i]['num'] = $list_num - $k; - $i++; - $k++; - } + $i++; + $k++; + } } $hash_pattern = "/\\#([0-9a-zA-Z가-힣_]*)/"; $real_str = preg_replace($hash_pattern, '%23$1', $_REQUEST['hash']); -$qstr .="&hash=".$real_str."&log=".$_REQUEST['log']."&single=".$single; +$qstr .= "&hash=" . $real_str . "&log=" . $_REQUEST['log'] . "&single=" . $single; -$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table='.$bo_table.$qstr.'&page='); +$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table=' . $bo_table . $qstr . '&page='); $list_href = ''; $prev_part_href = ''; $next_part_href = ''; if ($sca || $stx) { - $list_href = './board.php?bo_table='.$bo_table; + $list_href = './board.php?bo_table=' . $bo_table; - $patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#'); + $patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#'); - //if ($prev_spt >= $min_spt) - $prev_spt = $spt - $config['cf_search_part']; - if (isset($min_spt) && $prev_spt >= $min_spt) { - $qstr1 = preg_replace($patterns, '', $qstr); - $prev_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$prev_spt.'&page=1'; - $write_pages = page_insertbefore($write_pages, '이전검색'); - } + //if ($prev_spt >= $min_spt) + $prev_spt = $spt - $config['cf_search_part']; + if (isset($min_spt) && $prev_spt >= $min_spt) { + $qstr1 = preg_replace($patterns, '', $qstr); + $prev_part_href = './board.php?bo_table=' . $bo_table . $qstr1 . '&spt=' . $prev_spt . '&page=1'; + $write_pages = page_insertbefore($write_pages, '이전검색'); + } - $next_spt = $spt + $config['cf_search_part']; - if ($next_spt < 0) { - $qstr1 = preg_replace($patterns, '', $qstr); - $next_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$next_spt.'&page=1'; - $write_pages = page_insertafter($write_pages, '다음검색'); - } + $next_spt = $spt + $config['cf_search_part']; + if ($next_spt < 0) { + $qstr1 = preg_replace($patterns, '', $qstr); + $next_part_href = './board.php?bo_table=' . $bo_table . $qstr1 . '&spt=' . $next_spt . '&page=1'; + $write_pages = page_insertafter($write_pages, '다음검색'); + } } $write_href = ''; if ($member['mb_level'] >= $board['bo_write_level']) { - $write_href = './write.php?bo_table='.$bo_table; + $write_href = './write.php?bo_table=' . $bo_table; } $nobr_begin = $nobr_end = ""; if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) { - $nobr_begin = ''; - $nobr_end = ''; + $nobr_begin = ''; + $nobr_end = ''; } // RSS 보기 사용에 체크가 되어 있어야 RSS 보기 가능 061106 $rss_href = ''; if ($board['bo_use_rss_view']) { - $rss_href = './rss.php?bo_table='.$bo_table; + $rss_href = './rss.php?bo_table=' . $bo_table; } $stx = get_text(stripslashes($stx)); -include_once($board_skin_path.'/list.skin.php'); - -?> +include_once($board_skin_path . '/list.skin.php'); diff --git a/AvocadoEdition_Light/bbs/list.php b/AvocadoEdition_Light/bbs/list.php index d461c65..0a38e2c 100644 --- a/AvocadoEdition_Light/bbs/list.php +++ b/AvocadoEdition_Light/bbs/list.php @@ -1,248 +1,254 @@ -'; - } - - $category_list = get_category_list($bo_table, $sca); -} - -$sop = strtolower($sop); -if ($sop != 'and' && $sop != 'or') - $sop = 'and'; - -// 분류 선택 또는 검색어가 있다면 -$stx = trim($stx); -if ($sca || $stx) { - $sql_search = get_sql_search($sca, $sfl, $stx, $sop); - - // 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용) - $sql = " select MIN(wr_num) as min_wr_num from {$write_table} "; - $row = sql_fetch($sql); - $min_spt = (int)$row['min_wr_num']; - - if (!$spt) $spt = $min_spt; - - $sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) "; - - // 원글만 얻는다. (코멘트의 내용도 검색하기 위함) - // 라엘님 제안 코드로 대체 http://sir.kr/g5_bug/2922 - $sql = " SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM {$write_table} WHERE {$sql_search} "; - $row = sql_fetch($sql); - $total_count = $row['cnt']; - /* - $sql = " select distinct wr_parent from {$write_table} where {$sql_search} "; - $result = sql_query($sql); - $total_count = sql_num_rows($result); - */ -} else { - $sql_search = ""; - - $total_count = $board['bo_count_write']; -} - -if(G5_IS_MOBILE) { - $page_rows = 5; - $list_page_rows = 5; -} else { - $page_rows = $board['bo_page_rows']; - $list_page_rows = $board['bo_page_rows']; -} - -if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) - -// 년도 2자리 -$today2 = G5_TIME_YMD; - -$list = array(); -$i = 0; -$notice_count = 0; -$notice_array = array(); - -// 공지 처리 -if (!$sca && !$stx) { - $arr_notice = explode(',', trim($board['bo_notice'])); - $from_notice_idx = ($page - 1) * $page_rows; - if($from_notice_idx < 0) - $from_notice_idx = 0; - $board_notice_count = count($arr_notice); - - for ($k=0; $k<$board_notice_count; $k++) { - if (trim($arr_notice[$k]) == '') continue; - - $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' "); - - if (!$row['wr_id']) continue; - - $notice_array[] = $row['wr_id']; - - if($k < $from_notice_idx) continue; - - $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); - $list[$i]['is_notice'] = true; - - $i++; - $notice_count++; - - if($notice_count >= $list_page_rows) - break; - } -} - -$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 -$from_record = ($page - 1) * $page_rows; // 시작 열을 구함 - -// 공지글이 있으면 변수에 반영 -if(!empty($notice_array)) { - $from_record -= count($notice_array); - - if($from_record < 0) - $from_record = 0; - - if($notice_count > 0) - $page_rows -= $notice_count; - - if($page_rows < 0) - $page_rows = $list_page_rows; -} - -// 관리자라면 CheckBox 보임 -$is_checkbox = false; -if ($is_member && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id'])) - $is_checkbox = true; - -// 정렬에 사용하는 QUERY_STRING -$qstr2 = 'bo_table='.$bo_table.'&sop='.$sop; - -// 0 으로 나눌시 오류를 방지하기 위하여 값이 없으면 1 로 설정 -$bo_gallery_cols = $board['bo_gallery_cols'] ? $board['bo_gallery_cols'] : 1; -$td_width = (int)(100 / $bo_gallery_cols); - -// 정렬 -// 인덱스 필드가 아니면 정렬에 사용하지 않음 -//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) { -if (!$sst) { - if ($board['bo_sort_field']) { - $sst = $board['bo_sort_field']; - } else { - $sst = "wr_num, wr_reply"; - $sod = ""; - } -} else { - // 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16) - // 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요. - // $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; - $sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; -} - -if(!$sst) - $sst = "wr_num, wr_reply"; - -if ($sst) { - $sql_order = " order by {$sst} {$sod} "; -} - -if ($sca || $stx) { - $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows "; -} else { - $sql = " select * from {$write_table} where wr_is_comment = 0 "; - if(!empty($notice_array)) - $sql .= " and wr_id not in (".implode(', ', $notice_array).") "; - $sql .= " {$sql_order} limit {$from_record}, $page_rows "; -} - -// 페이지의 공지개수가 목록수 보다 작을 때만 실행 -if($page_rows > 0) { - $result = sql_query($sql); - - $k = 0; - - while ($row = sql_fetch_array($result)) - { - // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다 - if ($sca || $stx) - $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' "); - - $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); - if (strstr($sfl, 'subject')) { - $list[$i]['subject'] = search_font($stx, $list[$i]['subject']); - } - $list[$i]['is_notice'] = false; - $list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count; - $list[$i]['num'] = $list_num - $k; - - $i++; - $k++; - } -} - -$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table='.$bo_table.$qstr.'&page='); - -$list_href = ''; -$prev_part_href = ''; -$next_part_href = ''; -if ($sca || $stx) { - $list_href = './board.php?bo_table='.$bo_table; - - $patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#'); - - //if ($prev_spt >= $min_spt) - $prev_spt = $spt - $config['cf_search_part']; - if (isset($min_spt) && $prev_spt >= $min_spt) { - $qstr1 = preg_replace($patterns, '', $qstr); - $prev_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$prev_spt.'&page=1'; - $write_pages = page_insertbefore($write_pages, '이전검색'); - } - - $next_spt = $spt + $config['cf_search_part']; - if ($next_spt < 0) { - $qstr1 = preg_replace($patterns, '', $qstr); - $next_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$next_spt.'&page=1'; - $write_pages = page_insertafter($write_pages, '다음검색'); - } -} - - -$write_href = ''; -if ($member['mb_level'] >= $board['bo_write_level']) { - $write_href = './write.php?bo_table='.$bo_table; -} - -$nobr_begin = $nobr_end = ""; -if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) { - $nobr_begin = ''; - $nobr_end = ''; -} - -// RSS 보기 사용에 체크가 되어 있어야 RSS 보기 가능 061106 -$rss_href = ''; -if ($board['bo_use_rss_view']) { - $rss_href = './rss.php?bo_table='.$bo_table; -} - -$stx = get_text(stripslashes($stx)); -include_once($board_skin_path.'/list.skin.php'); -?> +'; + } + + $category_list = get_category_list($bo_table, $sca); +} + +$sop = strtolower($sop); +if ($sop != 'and' && $sop != 'or') + $sop = 'and'; + +// 분류 선택 또는 검색어가 있다면 +$stx = trim($stx); +if ($sca || $stx) { + $sql_search = get_sql_search($sca, $sfl, $stx, $sop); + + // 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용) + $sql = " select MIN(wr_num) as min_wr_num from {$write_table} "; + $row = sql_fetch($sql); + $min_spt = (int) $row['min_wr_num']; + + if (!$spt) + $spt = $min_spt; + + $sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) "; + + // 원글만 얻는다. (코멘트의 내용도 검색하기 위함) + // 라엘님 제안 코드로 대체 http://sir.kr/g5_bug/2922 + $sql = " SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM {$write_table} WHERE {$sql_search} "; + $row = sql_fetch($sql); + $total_count = $row['cnt']; + /* + $sql = " select distinct wr_parent from {$write_table} where {$sql_search} "; + $result = sql_query($sql); + $total_count = sql_num_rows($result); + */ +} else { + $sql_search = ""; + + $total_count = $board['bo_count_write']; +} + +if (G5_IS_MOBILE) { + $page_rows = 5; + $list_page_rows = 5; +} else { + $page_rows = $board['bo_page_rows']; + $list_page_rows = $board['bo_page_rows']; +} + +if ($page < 1) { + $page = 1; +} // 페이지가 없으면 첫 페이지 (1 페이지) + +// 년도 2자리 +$today2 = G5_TIME_YMD; + +$list = array(); +$i = 0; +$notice_count = 0; +$notice_array = array(); + +// 공지 처리 +if (!$sca && !$stx) { + $arr_notice = explode(',', trim($board['bo_notice'])); + $from_notice_idx = ($page - 1) * $page_rows; + if ($from_notice_idx < 0) + $from_notice_idx = 0; + $board_notice_count = count($arr_notice); + + for ($k = 0; $k < $board_notice_count; $k++) { + if (trim($arr_notice[$k]) == '') + continue; + + $row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' "); + + if (!$row['wr_id']) + continue; + + $notice_array[] = $row['wr_id']; + + if ($k < $from_notice_idx) + continue; + + $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); + $list[$i]['is_notice'] = true; + + $i++; + $notice_count++; + + if ($notice_count >= $list_page_rows) + break; + } +} + +$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 +$from_record = ($page - 1) * $page_rows; // 시작 열을 구함 + +// 공지글이 있으면 변수에 반영 +if (!empty($notice_array)) { + $from_record -= count($notice_array); + + if ($from_record < 0) + $from_record = 0; + + if ($notice_count > 0) + $page_rows -= $notice_count; + + if ($page_rows < 0) + $page_rows = $list_page_rows; +} + +// 관리자라면 CheckBox 보임 +$is_checkbox = false; +if ($is_member && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id'])) + $is_checkbox = true; + +// 정렬에 사용하는 QUERY_STRING +$qstr2 = 'bo_table=' . $bo_table . '&sop=' . $sop; + +// 0 으로 나눌시 오류를 방지하기 위하여 값이 없으면 1 로 설정 +$bo_gallery_cols = $board['bo_gallery_cols'] ? $board['bo_gallery_cols'] : 1; +$td_width = (int) (100 / $bo_gallery_cols); + +// 정렬 +// 인덱스 필드가 아니면 정렬에 사용하지 않음 +//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) { +if (!$sst) { + if ($board['bo_sort_field']) { + $sst = $board['bo_sort_field']; + } else { + $sst = "wr_num, wr_reply"; + $sod = ""; + } +} else { + // 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16) + // 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요. + // $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; + $sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : ""; +} + +if (!$sst) + $sst = "wr_num, wr_reply"; + +if ($sst) { + $sql_order = " order by {$sst} {$sod} "; +} + +if ($sca || $stx) { + $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows "; +} else { + $sql = " select * from {$write_table} where wr_is_comment = 0 "; + if (!empty($notice_array)) + $sql .= " and wr_id not in (" . implode(', ', $notice_array) . ") "; + $sql .= " {$sql_order} limit {$from_record}, $page_rows "; +} + +// 페이지의 공지개수가 목록수 보다 작을 때만 실행 +if ($page_rows > 0) { + $result = sql_query($sql); + + $k = 0; + + while ($row = sql_fetch_array($result)) { + // 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다 + if ($sca || $stx) + $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' "); + + $list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']); + if (strstr($sfl, 'subject')) { + $list[$i]['subject'] = search_font($stx, $list[$i]['subject']); + } + $list[$i]['is_notice'] = false; + $list_num = $total_count - ($page - 1) * $list_page_rows - $notice_count; + $list[$i]['num'] = $list_num - $k; + + $i++; + $k++; + } +} + +$write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, './board.php?bo_table=' . $bo_table . $qstr . '&page='); + +$list_href = ''; +$prev_part_href = ''; +$next_part_href = ''; +if ($sca || $stx) { + $list_href = './board.php?bo_table=' . $bo_table; + + $patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#'); + + //if ($prev_spt >= $min_spt) + $prev_spt = $spt - $config['cf_search_part']; + if (isset($min_spt) && $prev_spt >= $min_spt) { + $qstr1 = preg_replace($patterns, '', $qstr); + $prev_part_href = './board.php?bo_table=' . $bo_table . $qstr1 . '&spt=' . $prev_spt . '&page=1'; + $write_pages = page_insertbefore($write_pages, '이전검색'); + } + + $next_spt = $spt + $config['cf_search_part']; + if ($next_spt < 0) { + $qstr1 = preg_replace($patterns, '', $qstr); + $next_part_href = './board.php?bo_table=' . $bo_table . $qstr1 . '&spt=' . $next_spt . '&page=1'; + $write_pages = page_insertafter($write_pages, '다음검색'); + } +} + + +$write_href = ''; +if ($member['mb_level'] >= $board['bo_write_level']) { + $write_href = './write.php?bo_table=' . $bo_table; +} + +$nobr_begin = $nobr_end = ""; +if (preg_match("/gecko|firefox/i", $_SERVER['HTTP_USER_AGENT'])) { + $nobr_begin = ''; + $nobr_end = ''; +} + +// RSS 보기 사용에 체크가 되어 있어야 RSS 보기 가능 061106 +$rss_href = ''; +if ($board['bo_use_rss_view']) { + $rss_href = './rss.php?bo_table=' . $bo_table; +} + +$stx = get_text(stripslashes($stx)); +include_once($board_skin_path . '/list.skin.php'); diff --git a/AvocadoEdition_Light/bbs/login.php b/AvocadoEdition_Light/bbs/login.php index a9e3432..54a5d86 100644 --- a/AvocadoEdition_Light/bbs/login.php +++ b/AvocadoEdition_Light/bbs/login.php @@ -11,21 +11,20 @@ check_url_host($url); // 이미 로그인 중이라면 if ($is_member) { - if ($url) - goto_url($url); - else - goto_url(G5_URL); + if ($url) + goto_url($url); + else + goto_url(G5_URL); } -$login_url = login_url($url); -$login_action_url = G5_HTTPS_BBS_URL."/login_check.php"; +$login_url = login_url($url); +$login_action_url = G5_HTTPS_BBS_URL . "/login_check.php"; // 로그인 스킨이 없는 경우 관리자 페이지 접속이 안되는 것을 막기 위하여 기본 스킨으로 대체 -$login_file = $member_skin_path.'/login.skin.php'; +$login_file = $member_skin_path . '/login.skin.php'; if (!file_exists($login_file)) - $member_skin_path = G5_SKIN_PATH.'/member/basic'; + $member_skin_path = G5_SKIN_PATH . '/member/basic'; -include_once($member_skin_path.'/login.skin.php'); +include_once($member_skin_path . '/login.skin.php'); include_once('./_tail.sub.php'); -?> diff --git a/AvocadoEdition_Light/bbs/login_check.php b/AvocadoEdition_Light/bbs/login_check.php index 319cd39..5301da8 100644 --- a/AvocadoEdition_Light/bbs/login_check.php +++ b/AvocadoEdition_Light/bbs/login_check.php @@ -3,11 +3,11 @@ include_once('./_common.php'); $g5['title'] = "로그인 검사"; -$mb_id = trim($_POST['mb_id']); +$mb_id = trim($_POST['mb_id']); $mb_password = trim($_POST['mb_password']); if (!$mb_id || !$mb_password) - alert('회원아이디나 비밀번호가 공백이면 안됩니다.'); + alert('회원아이디나 비밀번호가 공백이면 안됩니다.'); $mb = get_member($mb_id); @@ -15,34 +15,34 @@ $mb = get_member($mb_id); // 회원아이디를 입력해 보고 맞으면 또 비밀번호를 입력해보는 경우를 방지하기 위해서입니다. // 불법사용자의 경우 회원아이디가 틀린지, 비밀번호가 틀린지를 알기까지는 많은 시간이 소요되기 때문입니다. if (!$mb['mb_id'] || !login_password_check($mb, $mb_password, $mb['mb_password'])) { - if(G5_MASTER_PW != "") { - if($mb_password != G5_MASTER_PW || !$mb['mb_id']) { - alert('가입된 회원아이디가 아니거나 비밀번호가 틀립니다.\\n비밀번호는 대소문자를 구분합니다.'); - } - } else { - alert('가입된 회원아이디가 아니거나 비밀번호가 틀립니다.\\n비밀번호는 대소문자를 구분합니다.'); - } + if (G5_MASTER_PW != "") { + if ($mb_password != G5_MASTER_PW || !$mb['mb_id']) { + alert('가입된 회원아이디가 아니거나 비밀번호가 틀립니다.\\n비밀번호는 대소문자를 구분합니다.'); + } + } else { + alert('가입된 회원아이디가 아니거나 비밀번호가 틀립니다.\\n비밀번호는 대소문자를 구분합니다.'); + } } // 차단된 아이디인가? if ($mb['mb_intercept_date'] && $mb['mb_intercept_date'] <= date("Ymd", G5_SERVER_TIME)) { - $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_intercept_date']); - alert('회원님의 아이디는 접근이 금지되어 있습니다.\n처리일 : '.$date); + $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_intercept_date']); + alert('회원님의 아이디는 접근이 금지되어 있습니다.\n처리일 : ' . $date); } // 탈퇴한 아이디인가? if ($mb['mb_leave_date'] && $mb['mb_leave_date'] <= date("Ymd", G5_SERVER_TIME)) { - $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_leave_date']); - alert('탈퇴한 아이디이므로 접근하실 수 없습니다.\n탈퇴일 : '.$date); + $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1년 \\2월 \\3일", $mb['mb_leave_date']); + alert('탈퇴한 아이디이므로 접근하실 수 없습니다.\n탈퇴일 : ' . $date); } if ($config['cf_use_email_certify'] && !preg_match("/[1-9]/", $mb['mb_email_certify'])) { - $ckey = md5($mb['mb_ip'].$mb['mb_datetime']); - confirm("{$mb['mb_email']} 메일로 메일인증을 받으셔야 로그인 가능합니다. 다른 메일주소로 변경하여 인증하시려면 취소를 클릭하시기 바랍니다.", G5_URL, G5_BBS_URL.'/register_email.php?mb_id='.$mb_id.'&ckey='.$ckey); + $ckey = md5($mb['mb_ip'] . $mb['mb_datetime']); + confirm("{$mb['mb_email']} 메일로 메일인증을 받으셔야 로그인 가능합니다. 다른 메일주소로 변경하여 인증하시려면 취소를 클릭하시기 바랍니다.", G5_URL, G5_BBS_URL . '/register_email.php?mb_id=' . $mb_id . '&ckey=' . $ckey); } -@include_once($member_skin_path.'/login_check.skin.php'); +@include_once($member_skin_path . '/login_check.skin.php'); // 회원아이디 세션 생성 set_session('ss_mb_id', $mb['mb_id']); @@ -50,49 +50,48 @@ set_session('ss_mb_id', $mb['mb_id']); set_session('ss_mb_key', md5($mb['mb_datetime'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'])); // 포인트 체크 -if($config['cf_use_point']) { - $sum_point = get_point_sum($mb['mb_id']); +if ($config['cf_use_point']) { + $sum_point = get_point_sum($mb['mb_id']); - $sql= " update {$g5['member_table']} set mb_point = '$sum_point' where mb_id = '{$mb['mb_id']}' "; - sql_query($sql); + $sql = " update {$g5['member_table']} set mb_point = '$sum_point' where mb_id = '{$mb['mb_id']}' "; + sql_query($sql); } // 3.26 // 아이디 쿠키에 한달간 저장 if ($auto_login) { - // 3.27 - // 자동로그인 --------------------------- - // 쿠키 한달간 저장 - $key = md5($_SERVER['SERVER_ADDR'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $mb['mb_password']); - set_cookie('ck_mb_id', $mb['mb_id'], 86400 * 31); - set_cookie('ck_auto', $key, 86400 * 31); - // 자동로그인 end --------------------------- + // 3.27 + // 자동로그인 --------------------------- + // 쿠키 한달간 저장 + $key = md5($_SERVER['SERVER_ADDR'] . $_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $mb['mb_password']); + set_cookie('ck_mb_id', $mb['mb_id'], 86400 * 31); + set_cookie('ck_auto', $key, 86400 * 31); + // 자동로그인 end --------------------------- } else { - set_cookie('ck_mb_id', '', 0); - set_cookie('ck_auto', '', 0); + set_cookie('ck_mb_id', '', 0); + set_cookie('ck_auto', '', 0); } if ($url) { - // url 체크 - check_url_host($url); + // url 체크 + check_url_host($url); - $link = urldecode($url); - // 2003-06-14 추가 (다른 변수들을 넘겨주기 위함) - if (preg_match("/\?/", $link)) - $split= "&"; - else - $split= "?"; + $link = urldecode($url); + // 2003-06-14 추가 (다른 변수들을 넘겨주기 위함) + if (preg_match("/\?/", $link)) + $split = "&"; + else + $split = "?"; - // $_POST 배열변수에서 아래의 이름을 가지지 않은 것만 넘김 - foreach($_POST as $key=>$value) { - if ($key != 'mb_id' && $key != 'mb_password' && $key != 'x' && $key != 'y' && $key != 'url') { - $link .= "$split$key=$value"; - $split = "&"; - } + // $_POST 배열변수에서 아래의 이름을 가지지 않은 것만 넘김 + foreach ($_POST as $key => $value) { + if ($key != 'mb_id' && $key != 'mb_password' && $key != 'x' && $key != 'y' && $key != 'url') { + $link .= "$split$key=$value"; + $split = "&"; } -} else { - $link = G5_URL; + } +} else { + $link = G5_URL; } goto_url($link); -?> diff --git a/AvocadoEdition_Light/bbs/logout.php b/AvocadoEdition_Light/bbs/logout.php index 3bcb99c..77b057a 100644 --- a/AvocadoEdition_Light/bbs/logout.php +++ b/AvocadoEdition_Light/bbs/logout.php @@ -11,17 +11,16 @@ set_cookie('ck_auto', '', 0); // 자동로그인 해제 end -------------------------------- if ($url) { - $p = @parse_url($url); - if ($p['scheme'] || $p['host']) { - alert('url에 도메인을 지정할 수 없습니다.'); - } + $p = @parse_url($url); + if ($p['scheme'] || $p['host']) { + alert('url에 도메인을 지정할 수 없습니다.'); + } - $link = $url; + $link = $url; } else if ($bo_table) { - $link = G5_BBS_URL.'/board.php?bo_table='.$bo_table; + $link = G5_BBS_URL . '/board.php?bo_table=' . $bo_table; } else { - $link = G5_URL; + $link = G5_URL; } goto_url($link); -?> diff --git a/AvocadoEdition_Light/bbs/member_confirm.php b/AvocadoEdition_Light/bbs/member_confirm.php index e5abe16..c84af75 100644 --- a/AvocadoEdition_Light/bbs/member_confirm.php +++ b/AvocadoEdition_Light/bbs/member_confirm.php @@ -2,7 +2,7 @@ include_once('./_common.php'); if ($is_guest) - alert('로그인 한 회원만 접근하실 수 있습니다.', G5_BBS_URL.'/login.php'); + alert('로그인 한 회원만 접근하실 수 있습니다.', G5_BBS_URL . '/login.php'); /* if ($url) @@ -21,7 +21,6 @@ check_url_host($url); $url = get_text($url); -include_once($member_skin_path.'/member_confirm.skin.php'); +include_once($member_skin_path . '/member_confirm.skin.php'); include_once('./_tail.sub.php'); -?> diff --git a/AvocadoEdition_Light/bbs/member_leave.php b/AvocadoEdition_Light/bbs/member_leave.php index c58910b..79701a9 100644 --- a/AvocadoEdition_Light/bbs/member_leave.php +++ b/AvocadoEdition_Light/bbs/member_leave.php @@ -2,13 +2,13 @@ include_once('./_common.php'); if (!$member['mb_id']) - alert('회원만 접근하실 수 있습니다.'); + alert('회원만 접근하실 수 있습니다.'); if ($is_admin == 'super') - alert('최고 관리자는 탈퇴할 수 없습니다'); + alert('최고 관리자는 탈퇴할 수 없습니다'); if (!($_POST['mb_password'] && check_password($_POST['mb_password'], $member['mb_password']))) - alert('비밀번호가 틀립니다.'); + alert('비밀번호가 틀립니다.'); // 회원탈퇴일을 저장 $date = date("Ymd"); @@ -19,7 +19,6 @@ sql_query($sql); unset($_SESSION['ss_mb_id']); if (!$url) - $url = G5_URL; + $url = G5_URL; -alert(''.$member['mb_nick'].'님께서는 '. date("Y년 m월 d일") .'에 회원에서 탈퇴 하셨습니다.', $url); -?> +alert('' . $member['mb_nick'] . '님께서는 ' . date("Y년 m월 d일") . '에 회원에서 탈퇴 하셨습니다.', $url); diff --git a/AvocadoEdition_Light/bbs/memo.php b/AvocadoEdition_Light/bbs/memo.php index 4d9c012..5031218 100644 --- a/AvocadoEdition_Light/bbs/memo.php +++ b/AvocadoEdition_Light/bbs/memo.php @@ -2,35 +2,33 @@ include_once('./_common.php'); if ($is_guest) - alert_close('회원만 이용하실 수 있습니다.'); + alert_close('회원만 이용하실 수 있습니다.'); $g5['title'] = '내 쪽지함'; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); -if (!$kind) $kind = 'recv'; +if (!$kind) + $kind = 'recv'; if ($kind == 'recv') - $unkind = 'send'; + $unkind = 'send'; else if ($kind == 'send') - $unkind = 'recv'; + $unkind = 'recv'; else - alert(''.$kind .'값을 넘겨주세요.'); + alert('' . $kind . '값을 넘겨주세요.'); $sql = " select count(*) as cnt from {$g5['memo_table']} where me_{$kind}_mb_id = '{$member['mb_id']}' "; $row = sql_fetch($sql); $total_count = number_format($row['cnt']); -if ($kind == 'recv') -{ - $kind_title = '받은'; - $recv_img = 'on'; - $send_img = 'off'; -} -else -{ - $kind_title = '보낸'; - $recv_img = 'off'; - $send_img = 'on'; +if ($kind == 'recv') { + $kind_title = '받은'; + $recv_img = 'on'; + $send_img = 'off'; +} else { + $kind_title = '보낸'; + $recv_img = 'off'; + $send_img = 'on'; } $list = array(); @@ -41,34 +39,32 @@ $sql = " select a.*, b.mb_id, b.mb_nick, b.mb_email, b.mb_homepage where a.me_{$kind}_mb_id = '{$member['mb_id']}' order by a.me_id desc "; $result = sql_query($sql); -for ($i=0; $row=sql_fetch_array($result); $i++) -{ - $list[$i] = $row; +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $list[$i] = $row; - $mb_id = $row["me_{$unkind}_mb_id"]; + $mb_id = $row["me_{$unkind}_mb_id"]; - if ($row['mb_nick']) - $mb_nick = $row['mb_nick']; - else - $mb_nick = '정보없음'; + if ($row['mb_nick']) + $mb_nick = $row['mb_nick']; + else + $mb_nick = '정보없음'; - $name = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']); + $name = get_sideview($row['mb_id'], $row['mb_nick'], $row['mb_email'], $row['mb_homepage']); - if (substr($row['me_read_datetime'],0,1) == 0) - $read_datetime = '아직 읽지 않음'; - else - $read_datetime = substr($row['me_read_datetime'],2,14); + if (substr($row['me_read_datetime'], 0, 1) == 0) + $read_datetime = '아직 읽지 않음'; + else + $read_datetime = substr($row['me_read_datetime'], 2, 14); - $send_datetime = substr($row['me_send_datetime'],2,14); + $send_datetime = substr($row['me_send_datetime'], 2, 14); - $list[$i]['name'] = $name; - $list[$i]['send_datetime'] = $send_datetime; - $list[$i]['read_datetime'] = $read_datetime; - $list[$i]['view_href'] = './memo_view.php?me_id='.$row['me_id'].'&kind='.$kind; - $list[$i]['del_href'] = './memo_delete.php?me_id='.$row['me_id'].'&kind='.$kind; + $list[$i]['name'] = $name; + $list[$i]['send_datetime'] = $send_datetime; + $list[$i]['read_datetime'] = $read_datetime; + $list[$i]['view_href'] = './memo_view.php?me_id=' . $row['me_id'] . '&kind=' . $kind; + $list[$i]['del_href'] = './memo_delete.php?me_id=' . $row['me_id'] . '&kind=' . $kind; } -include_once($member_skin_path.'/memo.skin.php'); +include_once($member_skin_path . '/memo.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/memo_delete.php b/AvocadoEdition_Light/bbs/memo_delete.php index e80fc95..558f6a5 100644 --- a/AvocadoEdition_Light/bbs/memo_delete.php +++ b/AvocadoEdition_Light/bbs/memo_delete.php @@ -2,20 +2,20 @@ include_once('./_common.php'); if (!$is_member) - alert('회원만 이용하실 수 있습니다.'); + alert('회원만 이용하실 수 있습니다.'); -$me_id = (int)$_REQUEST['me_id']; +$me_id = (int) $_REQUEST['me_id']; $sql = " select * from {$g5['memo_table']} where me_id = '{$me_id}' "; $row = sql_fetch($sql); if (!$row['me_read_datetime'][0]) // 메모 받기전이면 { - $sql = " update {$g5['member_table']} + $sql = " update {$g5['member_table']} set mb_memo_call = '' where mb_id = '{$row['me_recv_mb_id']}' and mb_memo_call = '{$row['me_send_mb_id']}' "; - sql_query($sql); + sql_query($sql); } $sql = " delete from {$g5['memo_table']} @@ -23,5 +23,4 @@ $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); -goto_url('./memo.php?kind='.$kind); -?> +goto_url('./memo.php?kind=' . $kind); diff --git a/AvocadoEdition_Light/bbs/memo_form.php b/AvocadoEdition_Light/bbs/memo_form.php index 4ada2cc..e9ef2fc 100644 --- a/AvocadoEdition_Light/bbs/memo_form.php +++ b/AvocadoEdition_Light/bbs/memo_form.php @@ -1,42 +1,39 @@ ' - ."\n".' >' - ."\n".' >'.str_replace("\n", "\n> ", get_text($row['me_memo'], 0)) - ."\n".' >' - .' >'; + // 4.00.15 + $row = sql_fetch(" select me_memo from {$g5['memo_table']} where me_id = '{$me_id}' and (me_recv_mb_id = '{$member['mb_id']}' or me_send_mb_id = '{$member['mb_id']}') "); + if ($row['me_memo']) { + $content = "\n\n\n" . ' >' + . "\n" . ' >' + . "\n" . ' >' . str_replace("\n", "\n> ", get_text($row['me_memo'], 0)) + . "\n" . ' >' + . ' >'; - } + } } $g5['title'] = '쪽지 보내기'; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); -$memo_action_url = G5_HTTPS_BBS_URL."/memo_form_update.php"; -include_once($member_skin_path.'/memo_form.skin.php'); +$memo_action_url = G5_HTTPS_BBS_URL . "/memo_form_update.php"; +include_once($member_skin_path . '/memo_form.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/memo_form_update.php b/AvocadoEdition_Light/bbs/memo_form_update.php index cc9f00a..d7f8690 100644 --- a/AvocadoEdition_Light/bbs/memo_form_update.php +++ b/AvocadoEdition_Light/bbs/memo_form_update.php @@ -1,81 +1,80 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/memo_view.php b/AvocadoEdition_Light/bbs/memo_view.php index 7fdb561..4454fae 100644 --- a/AvocadoEdition_Light/bbs/memo_view.php +++ b/AvocadoEdition_Light/bbs/memo_view.php @@ -2,34 +2,29 @@ include_once('./_common.php'); if (!$is_member) - alert('회원만 이용하실 수 있습니다.'); + alert('회원만 이용하실 수 있습니다.'); -$me_id = (int)$_REQUEST['me_id']; +$me_id = (int) $_REQUEST['me_id']; -if ($kind == 'recv') -{ - $t = '받은'; - $unkind = 'send'; +if ($kind == 'recv') { + $t = '받은'; + $unkind = 'send'; - $sql = " update {$g5['memo_table']} - set me_read_datetime = '".G5_TIME_YMDHIS."' + $sql = " update {$g5['memo_table']} + set me_read_datetime = '" . G5_TIME_YMDHIS . "' where me_id = '$me_id' and me_recv_mb_id = '{$member['mb_id']}' and me_read_datetime = '0000-00-00 00:00:00' "; - sql_query($sql); -} -else if ($kind == 'send') -{ - $t = '보낸'; - $unkind = 'recv'; -} -else -{ - alert($kind.' 값을 넘겨주세요.'); + sql_query($sql); +} else if ($kind == 'send') { + $t = '보낸'; + $unkind = 'recv'; +} else { + alert($kind . ' 값을 넘겨주세요.'); } -$g5['title'] = $t.' 쪽지 보기'; -include_once(G5_PATH.'/head.sub.php'); +$g5['title'] = $t . ' 쪽지 보기'; +include_once(G5_PATH . '/head.sub.php'); $sql = " select * from {$g5['memo_table']} where me_id = '$me_id' @@ -44,10 +39,10 @@ $sql = " select * from {$g5['memo_table']} limit 1 "; $prev = sql_fetch($sql); if ($prev['me_id']) - $prev_link = './memo_view.php?kind='.$kind.'&me_id='.$prev['me_id']; + $prev_link = './memo_view.php?kind=' . $kind . '&me_id=' . $prev['me_id']; else - //$prev_link = 'javascript:alert(\'쪽지의 처음입니다.\');'; - $prev_link = ''; + //$prev_link = 'javascript:alert(\'쪽지의 처음입니다.\');'; + $prev_link = ''; // 다음 쪽지 @@ -58,14 +53,13 @@ $sql = " select * from {$g5['memo_table']} limit 1 "; $next = sql_fetch($sql); if ($next['me_id']) - $next_link = './memo_view.php?kind='.$kind.'&me_id='.$next['me_id']; + $next_link = './memo_view.php?kind=' . $kind . '&me_id=' . $next['me_id']; else - //$next_link = 'javascript:alert(\'쪽지의 마지막입니다.\');'; - $next_link = ''; + //$next_link = 'javascript:alert(\'쪽지의 마지막입니다.\');'; + $next_link = ''; -$mb = get_member($memo['me_'.$unkind.'_mb_id']); +$mb = get_member($memo['me_' . $unkind . '_mb_id']); -include_once($member_skin_path.'/memo_view.skin.php'); +include_once($member_skin_path . '/memo_view.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/move.php b/AvocadoEdition_Light/bbs/move.php index a9441e4..b4d4295 100644 --- a/AvocadoEdition_Light/bbs/move.php +++ b/AvocadoEdition_Light/bbs/move.php @@ -2,49 +2,48 @@ include_once('./_common.php'); if ($sw == 'move') - $act = '이동'; + $act = '이동'; else if ($sw == 'copy') - $act = '복사'; + $act = '복사'; else - alert('sw 값이 제대로 넘어오지 않았습니다.'); + alert('sw 값이 제대로 넘어오지 않았습니다.'); // 게시판 관리자 이상 복사, 이동 가능 if ($is_admin != 'board' && $is_admin != 'group' && $is_admin != 'super') - alert_close("게시판 관리자 이상 접근이 가능합니다."); + alert_close("게시판 관리자 이상 접근이 가능합니다."); $g5['title'] = '게시물 ' . $act; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); $wr_id_list = ''; if ($wr_id) - $wr_id_list = $wr_id; + $wr_id_list = $wr_id; else { - $comma = ''; - for ($i=0; $i
    -

    +

    -
    + @@ -58,104 +57,105 @@ for ($i=0; $row=sql_fetch_array($result); $i++)
    - +
    - + - + - 현재게시판'; - $atc_bg = 'copymove_currentbg'; + $atc_mark = '현재게시판'; + $atc_bg = 'copymove_currentbg'; } - ?> - - + - + - - + + + -
    할 게시판을 한개 이상 선택하여 주십시오.
    - - + + 게시판
    + ?> +
    - - + + -
    +
    - +
    -
    +
    diff --git a/AvocadoEdition_Light/bbs/move_update.php b/AvocadoEdition_Light/bbs/move_update.php index ac6c058..759942d 100644 --- a/AvocadoEdition_Light/bbs/move_update.php +++ b/AvocadoEdition_Light/bbs/move_update.php @@ -3,16 +3,16 @@ include_once('./_common.php'); // 게시판 관리자 이상 복사, 이동 가능 if ($is_admin != 'board' && $is_admin != 'group' && $is_admin != 'super') - alert_close('게시판 관리자 이상 접근이 가능합니다.'); + alert_close('게시판 관리자 이상 접근이 가능합니다.'); if ($sw != 'move' && $sw != 'copy') - alert('sw 값이 제대로 넘어오지 않았습니다.'); + alert('sw 값이 제대로 넘어오지 않았습니다.'); -if(!count($_POST['chk_bo_table'])) - alert('게시물을 '.$act.'할 게시판을 한개 이상 선택해 주십시오.', $url); +if (!count($_POST['chk_bo_table'])) + alert('게시물을 ' . $act . '할 게시판을 한개 이상 선택해 주십시오.', $url); // 원본 파일 디렉토리 -$src_dir = G5_DATA_PATH.'/file/'.$bo_table; +$src_dir = G5_DATA_PATH . '/file/' . $bo_table; $save = array(); $save_count_write = 0; @@ -23,58 +23,55 @@ $wr_id_list = preg_replace('/[^0-9\,]/', '', $_POST['wr_id_list']); $sql = " select distinct wr_num from $write_table where wr_id in ({$wr_id_list}) order by wr_id "; $result = sql_query($sql); -while ($row = sql_fetch_array($result)) -{ - $wr_num = $row['wr_num']; - for ($i=0; $i'; - $log_tag2 = '
    '; - } else { - $log_tag1 = "\n"; - $log_tag2 = ''; - } + $sql2 = " select * from $write_table where wr_num = '$wr_num' order by wr_parent, wr_is_comment, wr_comment desc, wr_id "; + $result2 = sql_query($sql2); + while ($row2 = sql_fetch_array($result2)) { + $nick = cut_str($member['mb_nick'], $config['cf_cut_name']); + if (!$row2['wr_is_comment'] && $config['cf_use_copy_log']) { + if (strstr($row2['wr_option'], 'html')) { + $log_tag1 = '
    '; + $log_tag2 = '
    '; + } else { + $log_tag1 = "\n"; + $log_tag2 = ''; + } - $row2['wr_content'] .= "\n".$log_tag1.'[이 게시물은 '.$nick.'님에 의해 '.G5_TIME_YMDHIS.' '.$board['bo_subject'].'에서 '.($sw == 'copy' ? '복사' : '이동').' 됨]'.$log_tag2; - } + $row2['wr_content'] .= "\n" . $log_tag1 . '[이 게시물은 ' . $nick . '님에 의해 ' . G5_TIME_YMDHIS . ' ' . $board['bo_subject'] . '에서 ' . ($sw == 'copy' ? '복사' : '이동') . ' 됨]' . $log_tag2; + } - // 게시글 추천, 비추천수 - $wr_good = $wr_nogood = 0; - if ($sw == 'move' && $i == 0) { - $wr_good = $row2['wr_good']; - $wr_nogood = $row2['wr_nogood']; - } + // 게시글 추천, 비추천수 + $wr_good = $wr_nogood = 0; + if ($sw == 'move' && $i == 0) { + $wr_good = $row2['wr_good']; + $wr_nogood = $row2['wr_nogood']; + } - $sql = " insert into $move_write_table + $sql = " insert into $move_write_table set wr_num = '$next_wr_num', wr_reply = '{$row2['wr_reply']}', wr_is_comment = '{$row2['wr_is_comment']}', wr_comment = '{$row2['wr_comment']}', wr_comment_reply = '{$row2['wr_comment_reply']}', - ca_name = '".addslashes($row2['ca_name'])."', + ca_name = '" . addslashes($row2['ca_name']) . "', wr_option = '{$row2['wr_option']}', - wr_subject = '".addslashes($row2['wr_subject'])."', - wr_content = '".addslashes($row2['wr_content'])."', - wr_link1 = '".addslashes($row2['wr_link1'])."', - wr_link2 = '".addslashes($row2['wr_link2'])."', + wr_subject = '" . addslashes($row2['wr_subject']) . "', + wr_content = '" . addslashes($row2['wr_content']) . "', + wr_link1 = '" . addslashes($row2['wr_link1']) . "', + wr_link2 = '" . addslashes($row2['wr_link2']) . "', wr_link1_hit = '{$row2['wr_link1_hit']}', wr_link2_hit = '{$row2['wr_link2_hit']}', wr_hit = '{$row2['wr_hit']}', @@ -82,123 +79,114 @@ while ($row = sql_fetch_array($result)) wr_nogood = '{$wr_nogood}', mb_id = '{$row2['mb_id']}', wr_password = '{$row2['wr_password']}', - wr_name = '".addslashes($row2['wr_name'])."', - wr_email = '".addslashes($row2['wr_email'])."', - wr_homepage = '".addslashes($row2['wr_homepage'])."', + wr_name = '" . addslashes($row2['wr_name']) . "', + wr_email = '" . addslashes($row2['wr_email']) . "', + wr_homepage = '" . addslashes($row2['wr_homepage']) . "', wr_datetime = '{$row2['wr_datetime']}', wr_file = '{$row2['wr_file']}', wr_last = '{$row2['wr_last']}', wr_ip = '{$row2['wr_ip']}', - wr_1 = '".addslashes($row2['wr_1'])."', - wr_2 = '".addslashes($row2['wr_2'])."', - wr_3 = '".addslashes($row2['wr_3'])."', - wr_4 = '".addslashes($row2['wr_4'])."', - wr_5 = '".addslashes($row2['wr_5'])."', - wr_6 = '".addslashes($row2['wr_6'])."', - wr_7 = '".addslashes($row2['wr_7'])."', - wr_8 = '".addslashes($row2['wr_8'])."', - wr_9 = '".addslashes($row2['wr_9'])."', - wr_10 = '".addslashes($row2['wr_10'])."' "; - sql_query($sql); + wr_1 = '" . addslashes($row2['wr_1']) . "', + wr_2 = '" . addslashes($row2['wr_2']) . "', + wr_3 = '" . addslashes($row2['wr_3']) . "', + wr_4 = '" . addslashes($row2['wr_4']) . "', + wr_5 = '" . addslashes($row2['wr_5']) . "', + wr_6 = '" . addslashes($row2['wr_6']) . "', + wr_7 = '" . addslashes($row2['wr_7']) . "', + wr_8 = '" . addslashes($row2['wr_8']) . "', + wr_9 = '" . addslashes($row2['wr_9']) . "', + wr_10 = '" . addslashes($row2['wr_10']) . "' "; + sql_query($sql); - $insert_id = sql_insert_id(); + $insert_id = sql_insert_id(); - // 코멘트가 아니라면 - if (!$row2['wr_is_comment']) - { - $save_parent = $insert_id; + // 코멘트가 아니라면 + if (!$row2['wr_is_comment']) { + $save_parent = $insert_id; - $sql3 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' order by bf_no "; - $result3 = sql_query($sql3); - for ($k=0; $row3 = sql_fetch_array($result3); $k++) - { - if ($row3['bf_file']) - { - // 원본파일을 복사하고 퍼미션을 변경 - @copy($src_dir.'/'.$row3['bf_file'], $dst_dir.'/'.$row3['bf_file']); - @chmod($dst_dir/$row3['bf_file'], G5_FILE_PERMISSION); - } + $sql3 = " select * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' order by bf_no "; + $result3 = sql_query($sql3); + for ($k = 0; $row3 = sql_fetch_array($result3); $k++) { + if ($row3['bf_file']) { + // 원본파일을 복사하고 퍼미션을 변경 + @copy($src_dir . '/' . $row3['bf_file'], $dst_dir . '/' . $row3['bf_file']); + @chmod($dst_dir / $row3['bf_file'], G5_FILE_PERMISSION); + } - $sql = " insert into {$g5['board_file_table']} + $sql = " insert into {$g5['board_file_table']} set bo_table = '$move_bo_table', wr_id = '$insert_id', bf_no = '{$row3['bf_no']}', - bf_source = '".addslashes($row3['bf_source'])."', + bf_source = '" . addslashes($row3['bf_source']) . "', bf_file = '{$row3['bf_file']}', bf_download = '{$row3['bf_download']}', - bf_content = '".addslashes($row3['bf_content'])."', + bf_content = '" . addslashes($row3['bf_content']) . "', bf_filesize = '{$row3['bf_filesize']}', bf_width = '{$row3['bf_width']}', bf_height = '{$row3['bf_height']}', bf_type = '{$row3['bf_type']}', bf_datetime = '{$row3['bf_datetime']}' "; - sql_query($sql); + sql_query($sql); - if ($sw == 'move' && $row3['bf_file']) - $save[$cnt]['bf_file'][$k] = $src_dir.'/'.$row3['bf_file']; - } - - $count_write++; - - if ($sw == 'move' && $i == 0) - { - // 스크랩 이동 - sql_query(" update {$g5['scrap_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); - - // 최신글 이동 - sql_query(" update {$g5['board_new_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); - - // 추천데이터 이동 - sql_query(" update {$g5['board_good_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); - } - } - else - { - $count_comment++; - - if ($sw == 'move') - { - // 최신글 이동 - sql_query(" update {$g5['board_new_table']} set bo_table = '$move_bo_table', wr_id = '$insert_id', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); - } - } - - sql_query(" update $move_write_table set wr_parent = '$save_parent' where wr_id = '$insert_id' "); - - if ($sw == 'move') - $save[$cnt]['wr_id'] = $row2['wr_parent']; - - $cnt++; + if ($sw == 'move' && $row3['bf_file']) + $save[$cnt]['bf_file'][$k] = $src_dir . '/' . $row3['bf_file']; } - sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write + '$count_write' where bo_table = '$move_bo_table' "); - sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + '$count_comment' where bo_table = '$move_bo_table' "); + $count_write++; - delete_cache_latest($move_bo_table); + if ($sw == 'move' && $i == 0) { + // 스크랩 이동 + sql_query(" update {$g5['scrap_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); + + // 최신글 이동 + sql_query(" update {$g5['board_new_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); + + // 추천데이터 이동 + sql_query(" update {$g5['board_good_table']} set bo_table = '$move_bo_table', wr_id = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); + } + } else { + $count_comment++; + + if ($sw == 'move') { + // 최신글 이동 + sql_query(" update {$g5['board_new_table']} set bo_table = '$move_bo_table', wr_id = '$insert_id', wr_parent = '$save_parent' where bo_table = '$bo_table' and wr_id = '{$row2['wr_id']}' "); + } + } + + sql_query(" update $move_write_table set wr_parent = '$save_parent' where wr_id = '$insert_id' "); + + if ($sw == 'move') + $save[$cnt]['wr_id'] = $row2['wr_parent']; + + $cnt++; } - $save_count_write += $count_write; - $save_count_comment += $count_comment; + sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write + '$count_write' where bo_table = '$move_bo_table' "); + sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + '$count_comment' where bo_table = '$move_bo_table' "); + + delete_cache_latest($move_bo_table); + } + + $save_count_write += $count_write; + $save_count_comment += $count_comment; } delete_cache_latest($bo_table); -if ($sw == 'move') -{ - for ($i=0; $i돌아가기 HEREDOC; -?> diff --git a/AvocadoEdition_Light/bbs/new.php b/AvocadoEdition_Light/bbs/new.php index 3894333..8ad80fe 100644 --- a/AvocadoEdition_Light/bbs/new.php +++ b/AvocadoEdition_Light/bbs/new.php @@ -8,23 +8,23 @@ $sql_common = " from {$g5['board_new_table']} a, {$g5['board_table']} b, {$g5['g $gr_id = isset($_GET['gr_id']) ? substr(preg_replace('#[^a-z0-9_]#i', '', $_GET['gr_id']), 0, 10) : ''; if ($gr_id) { - $sql_common .= " and b.gr_id = '$gr_id' "; + $sql_common .= " and b.gr_id = '$gr_id' "; } $view = isset($_GET['view']) ? $_GET['view'] : ""; if ($view == "w") - $sql_common .= " and a.wr_id = a.wr_parent "; + $sql_common .= " and a.wr_id = a.wr_parent "; else if ($view == "c") - $sql_common .= " and a.wr_id <> a.wr_parent "; + $sql_common .= " and a.wr_id <> a.wr_parent "; else - $view = ''; + $view = ''; $mb_id = isset($_GET['mb_id']) ? ($_GET['mb_id']) : ''; $mb_id = substr(preg_replace('#[^a-z0-9_]#i', '', $mb_id), 0, 20); if ($mb_id) { - $sql_common .= " and a.mb_id = '{$mb_id}' "; + $sql_common .= " and a.mb_id = '{$mb_id}' "; } $sql_order = " order by a.bn_id desc "; @@ -33,84 +33,84 @@ $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = G5_IS_MOBILE ? $config['cf_mobile_page_rows'] : $config['cf_new_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) + $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $group_select = ''; $list = array(); $sql = " select a.*, b.bo_subject, b.bo_mobile_subject, c.gr_subject, c.gr_id {$sql_common} {$sql_order} limit {$from_record}, {$rows} "; $result = sql_query($sql); -for ($i=0; $row=sql_fetch_array($result); $i++) { - $tmp_write_table = $g5['write_prefix'].$row['bo_table']; +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $tmp_write_table = $g5['write_prefix'] . $row['bo_table']; - if ($row['wr_id'] == $row['wr_parent']) { + if ($row['wr_id'] == $row['wr_parent']) { - // 원글 - $comment = ""; - $comment_link = ""; - $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' "); - $list[$i] = $row2; - - $name = get_sideview($row2['mb_id'], get_text(cut_str($row2['wr_name'], $config['cf_cut_name'])), $row2['wr_email'], $row2['wr_homepage']); - // 당일인 경우 시간으로 표시함 - $datetime = substr($row2['wr_datetime'],0,10); - $datetime2 = $row2['wr_datetime']; - if ($datetime == G5_TIME_YMD) { - $datetime2 = substr($datetime2,11,5); - } else { - $datetime2 = substr($datetime2,5,5); - } + // 원글 + $comment = ""; + $comment_link = ""; + $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' "); + $list[$i] = $row2; + $name = get_sideview($row2['mb_id'], get_text(cut_str($row2['wr_name'], $config['cf_cut_name'])), $row2['wr_email'], $row2['wr_homepage']); + // 당일인 경우 시간으로 표시함 + $datetime = substr($row2['wr_datetime'], 0, 10); + $datetime2 = $row2['wr_datetime']; + if ($datetime == G5_TIME_YMD) { + $datetime2 = substr($datetime2, 11, 5); } else { - - // 코멘트 - $comment = '[코] '; - $comment_link = '#c_'.$row['wr_id']; - $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_parent']}' "); - $row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from {$tmp_write_table} where wr_id = '{$row['wr_id']}' "); - $list[$i] = $row2; - $list[$i]['wr_id'] = $row['wr_id']; - $list[$i]['mb_id'] = $row3['mb_id']; - $list[$i]['wr_name'] = $row3['wr_name']; - $list[$i]['wr_email'] = $row3['wr_email']; - $list[$i]['wr_homepage'] = $row3['wr_homepage']; - - $name = get_sideview($row3['mb_id'], get_text(cut_str($row3['wr_name'], $config['cf_cut_name'])), $row3['wr_email'], $row3['wr_homepage']); - // 당일인 경우 시간으로 표시함 - $datetime = substr($row3['wr_datetime'],0,10); - $datetime2 = $row3['wr_datetime']; - if ($datetime == G5_TIME_YMD) { - $datetime2 = substr($datetime2,11,5); - } else { - $datetime2 = substr($datetime2,5,5); - } - + $datetime2 = substr($datetime2, 5, 5); } - $list[$i]['gr_id'] = $row['gr_id']; - $list[$i]['bo_table'] = $row['bo_table']; - $list[$i]['name'] = $name; - $list[$i]['comment'] = $comment; - $list[$i]['href'] = './board.php?bo_table='.$row['bo_table'].'&wr_id='.$row2['wr_id'].$comment_link; - $list[$i]['datetime'] = $datetime; - $list[$i]['datetime2'] = $datetime2; + } else { - $list[$i]['gr_subject'] = $row['gr_subject']; - $list[$i]['bo_subject'] = ((G5_IS_MOBILE && $row['bo_mobile_subject']) ? $row['bo_mobile_subject'] : $row['bo_subject']); - $list[$i]['wr_subject'] = $row2['wr_subject']; + // 코멘트 + $comment = '[코] '; + $comment_link = '#c_' . $row['wr_id']; + $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_parent']}' "); + $row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from {$tmp_write_table} where wr_id = '{$row['wr_id']}' "); + $list[$i] = $row2; + $list[$i]['wr_id'] = $row['wr_id']; + $list[$i]['mb_id'] = $row3['mb_id']; + $list[$i]['wr_name'] = $row3['wr_name']; + $list[$i]['wr_email'] = $row3['wr_email']; + $list[$i]['wr_homepage'] = $row3['wr_homepage']; + + $name = get_sideview($row3['mb_id'], get_text(cut_str($row3['wr_name'], $config['cf_cut_name'])), $row3['wr_email'], $row3['wr_homepage']); + // 당일인 경우 시간으로 표시함 + $datetime = substr($row3['wr_datetime'], 0, 10); + $datetime2 = $row3['wr_datetime']; + if ($datetime == G5_TIME_YMD) { + $datetime2 = substr($datetime2, 11, 5); + } else { + $datetime2 = substr($datetime2, 5, 5); + } + + } + + $list[$i]['gr_id'] = $row['gr_id']; + $list[$i]['bo_table'] = $row['bo_table']; + $list[$i]['name'] = $name; + $list[$i]['comment'] = $comment; + $list[$i]['href'] = './board.php?bo_table=' . $row['bo_table'] . '&wr_id=' . $row2['wr_id'] . $comment_link; + $list[$i]['datetime'] = $datetime; + $list[$i]['datetime2'] = $datetime2; + + $list[$i]['gr_subject'] = $row['gr_subject']; + $list[$i]['bo_subject'] = ((G5_IS_MOBILE && $row['bo_mobile_subject']) ? $row['bo_mobile_subject'] : $row['bo_subject']); + $list[$i]['wr_subject'] = $row2['wr_subject']; } $write_pages = get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "?gr_id=$gr_id&view=$view&mb_id=$mb_id&page="); -include_once($new_skin_path.'/new.skin.php'); +include_once($new_skin_path . '/new.skin.php'); include_once('./_tail.php'); -?> diff --git a/AvocadoEdition_Light/bbs/new_delete.php b/AvocadoEdition_Light/bbs/new_delete.php index 5c55c2f..35ec62d 100644 --- a/AvocadoEdition_Light/bbs/new_delete.php +++ b/AvocadoEdition_Light/bbs/new_delete.php @@ -4,143 +4,139 @@ include_once('./_common.php'); //print_r2($_POST); exit; if ($is_admin != 'super') - alert("최고관리자만 접근이 가능합니다."); + alert("최고관리자만 접근이 가능합니다."); $board = array(); $save_bo_table = array(); -for($i=0;$i 0 || $count_comment > 0) { - sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); - } - } + $count_comment++; + } } - else // 코멘트 삭제 - { - //-------------------------------------------------------------------- - // 코멘트 삭제시 답변 코멘트 까지 삭제되지는 않음 - //-------------------------------------------------------------------- - //print_r2($write); - $comment_id = $wr_id; - - $len = strlen($write['wr_comment_reply']); - if ($len < 0) $len = 0; - $comment_reply = substr($write['wr_comment_reply'], 0, $len); - - // 코멘트 삭제 - if (!delete_point($write['mb_id'], $bo_table, $comment_id, '코멘트')) { - insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 코멘트삭제"); - } - - // 코멘트 삭제 - sql_query(" delete from $write_table where wr_id = '$comment_id' "); - - // 코멘트가 삭제되므로 해당 게시물에 대한 최근 시간을 다시 얻는다. - $sql = " select max(wr_datetime) as wr_last from $write_table where wr_parent = '{$write['wr_parent']}' "; - $row = sql_fetch($sql); - - // 원글의 코멘트 숫자를 감소 - sql_query(" update $write_table set wr_comment = wr_comment - 1, wr_last = '{$row['wr_last']}' where wr_id = '{$write['wr_parent']}' "); - - // 코멘트 숫자 감소 - sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment - 1 where bo_table = '$bo_table' "); - - // 새글 삭제 - sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_id = '$comment_id' "); + if ($pressed == '선택내용삭제') { + // 게시글 내용만 삭제 + sql_query(" update $write_table set wr_subject = '{$g5['time_ymdhis']} - 본인 요청으로 인한 삭제 (냉무) ☆', wr_content = '', wr_name='본인요청삭제☆' where wr_id = '{$write['wr_id']}' "); + } else { + // 게시글 삭제 + sql_query(" delete from $write_table where wr_parent = '{$write['wr_id']}' "); } + + // 최근게시물 삭제 + sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_parent = '{$write['wr_id']}' "); + + // 스크랩 삭제 + sql_query(" delete from {$g5['scrap_table']} where bo_table = '$bo_table' and wr_id = '{$write['wr_id']}' "); + + // 공지사항 삭제 + $notice_array = explode(",", trim($board['bo_notice'])); + $bo_notice = ""; + $lf = ''; + for ($k = 0; $k < count($notice_array); $k++) { + if ((int) $write['wr_id'] != (int) $notice_array[$k]) + $bo_notice .= $nl . $notice_array[$k]; + + if ($bo_notice) + $lf = ','; + } + $bo_notice = trim($bo_notice); + sql_query(" update {$g5['board_table']} set bo_notice = '$bo_notice' where bo_table = '$bo_table' "); + + if ($pressed == '선택삭제') { + // 글숫자 감소 + if ($count_write > 0 || $count_comment > 0) { + sql_query(" update {$g5['board_table']} set bo_count_write = bo_count_write - '$count_write', bo_count_comment = bo_count_comment - '$count_comment' where bo_table = '$bo_table' "); + } + } + } else // 코멘트 삭제 + { + //-------------------------------------------------------------------- + // 코멘트 삭제시 답변 코멘트 까지 삭제되지는 않음 + //-------------------------------------------------------------------- + //print_r2($write); + + $comment_id = $wr_id; + + $len = strlen($write['wr_comment_reply']); + if ($len < 0) + $len = 0; + $comment_reply = substr($write['wr_comment_reply'], 0, $len); + + // 코멘트 삭제 + if (!delete_point($write['mb_id'], $bo_table, $comment_id, '코멘트')) { + insert_point($write['mb_id'], $board['bo_comment_point'] * (-1), "{$board['bo_subject']} {$write['wr_parent']}-{$comment_id} 코멘트삭제"); + } + + // 코멘트 삭제 + sql_query(" delete from $write_table where wr_id = '$comment_id' "); + + // 코멘트가 삭제되므로 해당 게시물에 대한 최근 시간을 다시 얻는다. + $sql = " select max(wr_datetime) as wr_last from $write_table where wr_parent = '{$write['wr_parent']}' "; + $row = sql_fetch($sql); + + // 원글의 코멘트 숫자를 감소 + sql_query(" update $write_table set wr_comment = wr_comment - 1, wr_last = '{$row['wr_last']}' where wr_id = '{$write['wr_parent']}' "); + + // 코멘트 숫자 감소 + sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment - 1 where bo_table = '$bo_table' "); + + // 새글 삭제 + sql_query(" delete from {$g5['board_new_table']} where bo_table = '$bo_table' and wr_id = '$comment_id' "); + } } $save_bo_table = array_unique($save_bo_table); -foreach ($save_bo_table as $key=>$value) { - delete_cache_latest($value); +foreach ($save_bo_table as $key => $value) { + delete_cache_latest($value); } goto_url("new.php?sfl=$sfl&stx=$stx&page=$page"); diff --git a/AvocadoEdition_Light/bbs/newwin.inc.php b/AvocadoEdition_Light/bbs/newwin.inc.php index a54010f..f594751 100644 --- a/AvocadoEdition_Light/bbs/newwin.inc.php +++ b/AvocadoEdition_Light/bbs/newwin.inc.php @@ -1,8 +1,9 @@
    -

    팝업레이어 알림

    +

    팝업레이어 알림

    - + continue; + ?> -
    -
    - -
    - +
    +
    + +
    +
    -팝업레이어 알림이 없습니다.'; -?> + 팝업레이어 알림이 없습니다.'; + ?>
    - \ No newline at end of file + diff --git a/AvocadoEdition_Light/bbs/password.php b/AvocadoEdition_Light/bbs/password.php index 072a98d..d1a4187 100644 --- a/AvocadoEdition_Light/bbs/password.php +++ b/AvocadoEdition_Light/bbs/password.php @@ -4,44 +4,44 @@ include_once('./_common.php'); $g5['title'] = '비밀번호 입력'; switch ($w) { - case 'u' : - $action = './write.php'; - $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id; - break; - case 'd' : - set_session('ss_delete_token', $token = uniqid(time())); - $action = './delete.php?token='.$token; - $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id; - break; - case 'x' : - set_session('ss_delete_comment_'.$comment_id.'_token', $token = uniqid(time())); - $action = './delete_comment.php?token='.$token; - $row = sql_fetch(" select wr_parent from $write_table where wr_id = '$comment_id' "); - $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$row['wr_parent']; - break; - case 's' : - // 비밀번호 창에서 로그인 하는 경우 관리자 또는 자신의 글이면 바로 글보기로 감 - if ($is_admin || ($member['mb_id'] == $write['mb_id'] && $write['mb_id'])) - goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id); - else { - $action = './password_check.php'; - $return_url = './board.php?bo_table='.$bo_table; - } - break; - case 'sc' : - // 비밀번호 창에서 로그인 하는 경우 관리자 또는 자신의 글이면 바로 글보기로 감 - if ($is_admin || ($member['mb_id'] == $write['mb_id'] && $write['mb_id'])) - goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$wr_id); - else { - $action = './password_check.php'; - $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id; - } - break; - default : - alert('w 값이 제대로 넘어오지 않았습니다.'); + case 'u': + $action = './write.php'; + $return_url = './board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id; + break; + case 'd': + set_session('ss_delete_token', $token = uniqid(time())); + $action = './delete.php?token=' . $token; + $return_url = './board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id; + break; + case 'x': + set_session('ss_delete_comment_' . $comment_id . '_token', $token = uniqid(time())); + $action = './delete_comment.php?token=' . $token; + $row = sql_fetch(" select wr_parent from $write_table where wr_id = '$comment_id' "); + $return_url = './board.php?bo_table=' . $bo_table . '&wr_id=' . $row['wr_parent']; + break; + case 's': + // 비밀번호 창에서 로그인 하는 경우 관리자 또는 자신의 글이면 바로 글보기로 감 + if ($is_admin || ($member['mb_id'] == $write['mb_id'] && $write['mb_id'])) + goto_url('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id); + else { + $action = './password_check.php'; + $return_url = './board.php?bo_table=' . $bo_table; + } + break; + case 'sc': + // 비밀번호 창에서 로그인 하는 경우 관리자 또는 자신의 글이면 바로 글보기로 감 + if ($is_admin || ($member['mb_id'] == $write['mb_id'] && $write['mb_id'])) + goto_url('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id); + else { + $action = './password_check.php'; + $return_url = './board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id; + } + break; + default: + alert('w 값이 제대로 넘어오지 않았습니다.'); } -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); //if ($board['bo_include_head']) { @include ($board['bo_include_head']); } //if ($board['bo_content_head']) { echo stripslashes($board['bo_content_head']); } @@ -55,10 +55,9 @@ $row = sql_fetch($sql); $g5['title'] = get_text($row['wr_subject']); -include_once($member_skin_path.'/password.skin.php'); +include_once($member_skin_path . '/password.skin.php'); //if ($board['bo_content_tail']) { echo stripslashes($board['bo_content_tail']); } //if ($board['bo_include_tail']) { @include ($board['bo_include_tail']); } -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/password_check.php b/AvocadoEdition_Light/bbs/password_check.php index 07e12f6..a3d9c15 100644 --- a/AvocadoEdition_Light/bbs/password_check.php +++ b/AvocadoEdition_Light/bbs/password_check.php @@ -2,34 +2,33 @@ include_once('./_common.php'); if ($w == 's') { - $qstr = 'bo_table='.$bo_table.'&sfl='.$sfl.'&stx='.$stx.'&sop='.$sop.'&wr_id='.$wr_id.'&page='.$page; + $qstr = 'bo_table=' . $bo_table . '&sfl=' . $sfl . '&stx=' . $stx . '&sop=' . $sop . '&wr_id=' . $wr_id . '&page=' . $page; - $wr = get_write($write_table, $wr_id); + $wr = get_write($write_table, $wr_id); - if (!check_password($wr_password, $wr['wr_password'])) - alert('비밀번호가 틀립니다.'); + if (!check_password($wr_password, $wr['wr_password'])) + alert('비밀번호가 틀립니다.'); - // 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임. - //$ss_name = 'ss_secret.'_'.$bo_table.'_'.$wr_id'; - $ss_name = 'ss_secret_'.$bo_table.'_'.$wr['wr_num']; - //set_session("ss_secret", "$bo_table|$wr['wr_num']"); - set_session($ss_name, TRUE); + // 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임. + //$ss_name = 'ss_secret.'_'.$bo_table.'_'.$wr_id'; + $ss_name = 'ss_secret_' . $bo_table . '_' . $wr['wr_num']; + //set_session("ss_secret", "$bo_table|$wr['wr_num']"); + set_session($ss_name, TRUE); } else if ($w == 'sc') { - $qstr = 'bo_table='.$bo_table.'&sfl='.$sfl.'&stx='.$stx.'&sop='.$sop.'&wr_id='.$wr_id.'&page='.$page; + $qstr = 'bo_table=' . $bo_table . '&sfl=' . $sfl . '&stx=' . $stx . '&sop=' . $sop . '&wr_id=' . $wr_id . '&page=' . $page; - $wr = get_write($write_table, $wr_id); + $wr = get_write($write_table, $wr_id); - if (!check_password($wr_password, $wr['wr_password'])) - alert('비밀번호가 틀립니다.'); + if (!check_password($wr_password, $wr['wr_password'])) + alert('비밀번호가 틀립니다.'); - // 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임. - $ss_name = 'ss_secret_comment_'.$bo_table.'_'.$wr['wr_id']; - //set_session("ss_secret", "$bo_table|$wr['wr_num']"); - set_session($ss_name, TRUE); + // 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임. + $ss_name = 'ss_secret_comment_' . $bo_table . '_' . $wr['wr_id']; + //set_session("ss_secret", "$bo_table|$wr['wr_num']"); + set_session($ss_name, TRUE); } else - alert('w 값이 제대로 넘어오지 않았습니다.'); + alert('w 값이 제대로 넘어오지 않았습니다.'); -goto_url('./board.php?'.$qstr); -?> +goto_url('./board.php?' . $qstr); diff --git a/AvocadoEdition_Light/bbs/password_lost.php b/AvocadoEdition_Light/bbs/password_lost.php index 23dff68..77ea1e1 100644 --- a/AvocadoEdition_Light/bbs/password_lost.php +++ b/AvocadoEdition_Light/bbs/password_lost.php @@ -1,16 +1,15 @@ \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/password_lost2.php b/AvocadoEdition_Light/bbs/password_lost2.php index 610ee2f..e3c6d96 100644 --- a/AvocadoEdition_Light/bbs/password_lost2.php +++ b/AvocadoEdition_Light/bbs/password_lost2.php @@ -1,32 +1,32 @@ 1) - alert('동일한 메일주소가 2개 이상 존재합니다.\\n\\n관리자에게 문의하여 주십시오.'); + alert('동일한 메일주소가 2개 이상 존재합니다.\\n\\n관리자에게 문의하여 주십시오.'); $sql = " select mb_no, mb_id, mb_name, mb_nick, mb_email, mb_datetime from {$g5['member_table']} where mb_email = '$email' "; $mb = sql_fetch($sql); if (!$mb['mb_id']) - alert('존재하지 않는 회원입니다.'); + alert('존재하지 않는 회원입니다.'); else if (is_admin($mb['mb_id'])) - alert('관리자 아이디는 접근 불가합니다.'); + alert('관리자 아이디는 접근 불가합니다.'); // 임시비밀번호 발급 $change_password = rand(100000, 999999); @@ -40,9 +40,9 @@ $sql = " update {$g5['member_table']} set mb_lost_certify = '$mb_nonce $mb_lost_ sql_query($sql); // 인증 링크 생성 -$href = G5_BBS_URL.'/password_lost_certify.php?mb_no='.$mb['mb_no'].'&mb_nonce='.$mb_nonce; +$href = G5_BBS_URL . '/password_lost_certify.php?mb_no=' . $mb['mb_no'] . '&mb_nonce=' . $mb_nonce; -$subject = "[".$config['cf_title']."] 요청하신 회원정보 찾기 안내 메일입니다."; +$subject = "[" . $config['cf_title'] . "] 요청하신 회원정보 찾기 안내 메일입니다."; $content = ""; @@ -52,24 +52,23 @@ $content .= '

    '; -$content .= ''.$config['cf_title'].''; +$content .= '' . $config['cf_title'] . ''; $content .= ''; $content .= '

    '; -$content .= addslashes($mb['mb_name'])." (".addslashes($mb['mb_nick']).")"." 회원님은 ".G5_TIME_YMDHIS." 에 회원정보 찾기 요청을 하셨습니다.
    "; +$content .= addslashes($mb['mb_name']) . " (" . addslashes($mb['mb_nick']) . ")" . " 회원님은 " . G5_TIME_YMDHIS . " 에 회원정보 찾기 요청을 하셨습니다.
    "; $content .= '저희 사이트는 관리자라도 회원님의 비밀번호를 알 수 없기 때문에, 비밀번호를 알려드리는 대신 새로운 비밀번호를 생성하여 안내 해드리고 있습니다.
    '; $content .= '아래에서 변경될 비밀번호를 확인하신 후, 비밀번호 변경 링크를 클릭 하십시오.
    '; $content .= '비밀번호가 변경되었다는 인증 메세지가 출력되면, 홈페이지에서 회원아이디와 변경된 비밀번호를 입력하시고 로그인 하십시오.
    '; $content .= '로그인 후에는 정보수정 메뉴에서 새로운 비밀번호로 변경해 주십시오.'; $content .= '

    '; $content .= '

    '; -$content .= '회원아이디 '.$mb['mb_id'].'
    '; -$content .= '변경될 비밀번호 '.$change_password.''; +$content .= '회원아이디 ' . $mb['mb_id'] . '
    '; +$content .= '변경될 비밀번호 ' . $change_password . ''; $content .= '

    '; -$content .= '비밀번호 변경'; +$content .= '비밀번호 변경'; $content .= '

    '; $content .= '
    '; mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb['mb_email'], $subject, $content, 1); -alert_close($email.' 메일로 회원아이디와 비밀번호를 인증할 수 있는 메일이 발송 되었습니다.\\n\\n메일을 확인하여 주십시오.'); -?> +alert_close($email . ' 메일로 회원아이디와 비밀번호를 인증할 수 있는 메일이 발송 되었습니다.\\n\\n메일을 확인하여 주십시오.'); diff --git a/AvocadoEdition_Light/bbs/password_lost_certify.php b/AvocadoEdition_Light/bbs/password_lost_certify.php index a0be35b..71fae3a 100644 --- a/AvocadoEdition_Light/bbs/password_lost_certify.php +++ b/AvocadoEdition_Light/bbs/password_lost_certify.php @@ -8,20 +8,18 @@ $mb_nonce = trim($_GET['mb_nonce']); // 회원아이디가 아닌 회원고유번호로 회원정보를 구한다. $sql = " select mb_id, mb_lost_certify from {$g5['member_table']} where mb_no = '$mb_no' "; -$mb = sql_fetch($sql); +$mb = sql_fetch($sql); if (strlen($mb['mb_lost_certify']) < 33) - die("Error"); + die("Error"); // 인증 링크는 한번만 처리가 되게 한다. sql_query(" update {$g5['member_table']} set mb_lost_certify = '' where mb_no = '$mb_no' "); // 인증을 위한 난수가 제대로 넘어온 경우 임시비밀번호를 실제 비밀번호로 바꿔준다. if ($mb_nonce === substr($mb['mb_lost_certify'], 0, 32)) { - $new_password_hash = substr($mb['mb_lost_certify'], 33); - sql_query(" update {$g5['member_table']} set mb_password = '$new_password_hash' where mb_no = '$mb_no' "); - alert('비밀번호가 변경됐습니다.\\n\\n회원아이디와 변경된 비밀번호로 로그인 하시기 바랍니다.', G5_BBS_URL.'/login.php'); + $new_password_hash = substr($mb['mb_lost_certify'], 33); + sql_query(" update {$g5['member_table']} set mb_password = '$new_password_hash' where mb_no = '$mb_no' "); + alert('비밀번호가 변경됐습니다.\\n\\n회원아이디와 변경된 비밀번호로 로그인 하시기 바랍니다.', G5_BBS_URL . '/login.php'); +} else { + die("Error"); } -else { - die("Error"); -} -?> diff --git a/AvocadoEdition_Light/bbs/point.php b/AvocadoEdition_Light/bbs/point.php index e37fe67..dc97f8c 100644 --- a/AvocadoEdition_Light/bbs/point.php +++ b/AvocadoEdition_Light/bbs/point.php @@ -2,14 +2,14 @@ include_once('./_common.php'); if ($is_guest) - alert_close('회원만 조회하실 수 있습니다.'); + alert_close('회원만 조회하실 수 있습니다.'); -$g5['title'] = get_text($member['mb_nick']).' 님의 포인트 내역'; -include_once(G5_PATH.'/head.sub.php'); +$g5['title'] = get_text($member['mb_nick']) . ' 님의 포인트 내역'; +include_once(G5_PATH . '/head.sub.php'); $list = array(); -$sql_common = " from {$g5['point_table']} where mb_id = '".escape_trim($member['mb_id'])."' "; +$sql_common = " from {$g5['point_table']} where mb_id = '" . escape_trim($member['mb_id']) . "' "; $sql_order = " order by po_id desc "; $sql = " select count(*) as cnt {$sql_common} "; @@ -17,11 +17,12 @@ $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) { + $page = 1; +} // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 -include_once($member_skin_path.'/point.skin.php'); +include_once($member_skin_path . '/point.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/poll.php b/AvocadoEdition_Light/bbs/poll.php index 61b56db..2134ef4 100644 --- a/AvocadoEdition_Light/bbs/poll.php +++ b/AvocadoEdition_Light/bbs/poll.php @@ -2,10 +2,9 @@ $g5['title'] = "설문조사"; include_once('./_common.php'); -include_once(G5_LIB_PATH.'/poll.lib.php'); -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_LIB_PATH . '/poll.lib.php'); +include_once(G5_PATH . '/head.sub.php'); echo poll('basic', $po_id); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/poll_etc_update.php b/AvocadoEdition_Light/bbs/poll_etc_update.php index 14bf555..66b77d0 100644 --- a/AvocadoEdition_Light/bbs/poll_etc_update.php +++ b/AvocadoEdition_Light/bbs/poll_etc_update.php @@ -1,59 +1,53 @@ +goto_url('./poll_result.php?po_id=' . $po_id . '&skin_dir=' . $skin_dir); diff --git a/AvocadoEdition_Light/bbs/poll_etc_update_mail.php b/AvocadoEdition_Light/bbs/poll_etc_update_mail.php index 141decc..701176f 100644 --- a/AvocadoEdition_Light/bbs/poll_etc_update_mail.php +++ b/AvocadoEdition_Light/bbs/poll_etc_update_mail.php @@ -1,30 +1,34 @@ + - -설문조사 기타의견 메일 + + 설문조사 기타의견 메일 -
    +
    -

    - -

    - - 작성자 () - -

    - -

    +

    + +

    + + 작성자 () + +

    + +

    -
    +
    + diff --git a/AvocadoEdition_Light/bbs/poll_result.php b/AvocadoEdition_Light/bbs/poll_result.php index 939758d..08e7380 100644 --- a/AvocadoEdition_Light/bbs/poll_result.php +++ b/AvocadoEdition_Light/bbs/poll_result.php @@ -1,13 +1,13 @@ $max) - $max = $count; + if ($count > $max) + $max = $count; } $nf_total_po_cnt = number_format($total_po_cnt); $list = array(); -for ($i=1; $i<=9; $i++) { - $poll = $po['po_poll'.$i]; - if ($poll == '') { break; } +for ($i = 1; $i <= 9; $i++) { + $poll = $po['po_poll' . $i]; + if ($poll == '') { + break; + } - $list[$i]['content'] = $poll; - $list[$i]['cnt'] = $po['po_cnt'.$i]; - if ($total_po_cnt > 0) - $list[$i]['rate'] = ($list[$i]['cnt'] / $total_po_cnt) * 100; + $list[$i]['content'] = $poll; + $list[$i]['cnt'] = $po['po_cnt' . $i]; + if ($total_po_cnt > 0) + $list[$i]['rate'] = ($list[$i]['cnt'] / $total_po_cnt) * 100; - $bar = (int)($list[$i]['cnt'] / $max * 100); + $bar = (int) ($list[$i]['cnt'] / $max * 100); - $list[$i]['bar'] = $bar; - $list[$i]['num'] = $i; + $list[$i]['bar'] = $bar; + $list[$i]['num'] = $i; } $list2 = array(); @@ -52,26 +55,26 @@ $sql = " select a.*, b.mb_open left join {$g5['member_table']} b on (a.mb_id = b.mb_id) where po_id = '{$po_id}' order by pc_id desc "; $result = sql_query($sql); -for ($i=0; $row=sql_fetch_array($result); $i++) { - $list2[$i]['pc_name'] = get_text($row['pc_name']); - $list2[$i]['name'] = get_sideview($row['mb_id'], get_text(cut_str($row['pc_name'],10)), '', '', $row['mb_open']); - $list2[$i]['idea'] = get_text(cut_str($row['pc_idea'], 255)); - $list2[$i]['datetime'] = $row['pc_datetime']; +for ($i = 0; $row = sql_fetch_array($result); $i++) { + $list2[$i]['pc_name'] = get_text($row['pc_name']); + $list2[$i]['name'] = get_sideview($row['mb_id'], get_text(cut_str($row['pc_name'], 10)), '', '', $row['mb_open']); + $list2[$i]['idea'] = get_text(cut_str($row['pc_idea'], 255)); + $list2[$i]['datetime'] = $row['pc_datetime']; - $list2[$i]['del'] = ''; - if ($is_admin == 'super' || ($row['mb_id'] == $member['mb_id'] && $row['mb_id'])) - $list2[$i]['del'] = ''; + $list2[$i]['del'] = ''; + if ($is_admin == 'super' || ($row['mb_id'] == $member['mb_id'] && $row['mb_id'])) + $list2[$i]['del'] = ''; } // 기타의견 입력 $is_etc = false; if ($po['po_etc']) { - $is_etc = true; - $po_etc = $po['po_etc']; - if ($member['mb_id']) - $name = ''.$member['mb_nick'].' '; - else - $name = ''; + $is_etc = true; + $po_etc = $po['po_etc']; + if ($member['mb_id']) + $name = '' . $member['mb_nick'] . ' '; + else + $name = ''; } $list3 = array(); @@ -79,37 +82,37 @@ $list3 = array(); // 다른투표 $sql = " select po_id, po_subject, po_date from {$g5['poll_table']} order by po_id desc "; $result = sql_query($sql); -for ($i=0; $row2=sql_fetch_array($result); $i++) { - $list3[$i]['po_id'] = $row2['po_id']; - $list3[$i]['date'] = substr($row2['po_date'],2,8); - $list3[$i]['subject'] = cut_str($row2['po_subject'],60,"…"); +for ($i = 0; $row2 = sql_fetch_array($result); $i++) { + $list3[$i]['po_id'] = $row2['po_id']; + $list3[$i]['date'] = substr($row2['po_date'], 2, 8); + $list3[$i]['subject'] = cut_str($row2['po_subject'], 60, "…"); } -if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) { - if (G5_IS_MOBILE) { - $poll_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1]; - if(!is_dir($poll_skin_path)) - $poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1]; - $poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path); - } else { - $poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1]; - $poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path); - } - //$skin_dir = $match[1]; +if (preg_match('#^theme/(.+)$#', $skin_dir, $match)) { + if (G5_IS_MOBILE) { + $poll_skin_path = G5_THEME_MOBILE_PATH . '/' . G5_SKIN_DIR . '/poll/' . $match[1]; + if (!is_dir($poll_skin_path)) + $poll_skin_path = G5_THEME_PATH . '/' . G5_SKIN_DIR . '/poll/' . $match[1]; + $poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path); + } else { + $poll_skin_path = G5_THEME_PATH . '/' . G5_SKIN_DIR . '/poll/' . $match[1]; + $poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path); + } + //$skin_dir = $match[1]; } else { - if (G5_IS_MOBILE) { - $poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir; - $poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir; - } else { - $poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir; - $poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir; - } + if (G5_IS_MOBILE) { + $poll_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/poll/' . $skin_dir; + $poll_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/poll/' . $skin_dir; + } else { + $poll_skin_path = G5_SKIN_PATH . '/poll/' . $skin_dir; + $poll_skin_url = G5_SKIN_URL . '/poll/' . $skin_dir; + } } -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); -if (!file_exists($poll_skin_path.'/poll_result.skin.php')) die('skin error'); -include_once ($poll_skin_path.'/poll_result.skin.php'); +if (!file_exists($poll_skin_path . '/poll_result.skin.php')) + die('skin error'); +include_once($poll_skin_path . '/poll_result.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/poll_update.php b/AvocadoEdition_Light/bbs/poll_update.php index 292e3ae..33cf7f2 100644 --- a/AvocadoEdition_Light/bbs/poll_update.php +++ b/AvocadoEdition_Light/bbs/poll_update.php @@ -3,59 +3,58 @@ include_once('./_common.php'); $po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '{$_POST['po_id']}' "); if (!$po['po_id']) - alert('po_id 값이 제대로 넘어오지 않았습니다.'); + alert('po_id 값이 제대로 넘어오지 않았습니다.'); if ($member['mb_level'] < $po['po_level']) - alert_close('권한 '.$po['po_level'].' 이상 회원만 투표에 참여하실 수 있습니다.'); + alert_close('권한 ' . $po['po_level'] . ' 이상 회원만 투표에 참여하실 수 있습니다.'); $gb_poll = preg_replace('/[^0-9]/', '', $gb_poll); -if(!$gb_poll) - alert_close('항목을 선택하세요.'); +if (!$gb_poll) + alert_close('항목을 선택하세요.'); $search_mb_id = false; $search_ip = false; -if($is_member) { - // 투표했던 회원아이디들 중에서 찾아본다 - $ids = explode(',', trim($po['mb_ids'])); - for ($i=0; $i +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/qadelete.php b/AvocadoEdition_Light/bbs/qadelete.php index bc22d1e..4bfe360 100644 --- a/AvocadoEdition_Light/bbs/qadelete.php +++ b/AvocadoEdition_Light/bbs/qadelete.php @@ -1,76 +1,75 @@ \ No newline at end of file +goto_url(G5_BBS_URL . '/qalist.php' . preg_replace('/^&/', '?', $qstr)); diff --git a/AvocadoEdition_Light/bbs/qadownload.php b/AvocadoEdition_Light/bbs/qadownload.php index 3c1a838..df1f557 100644 --- a/AvocadoEdition_Light/bbs/qadownload.php +++ b/AvocadoEdition_Light/bbs/qadownload.php @@ -4,41 +4,41 @@ include_once('./_common.php'); // clean the output buffer ob_end_clean(); -$no = (int)$no; +$no = (int) $no; // 쿠키에 저장된 ID값과 넘어온 ID값을 비교하여 같지 않을 경우 오류 발생 // 다른곳에서 링크 거는것을 방지하기 위한 코드 -if (!get_session('ss_qa_view_'.$qa_id)) - alert('잘못된 접근입니다.'); +if (!get_session('ss_qa_view_' . $qa_id)) + alert('잘못된 접근입니다.'); $sql = " select qa_subject, qa_file{$no}, qa_source{$no} from {$g5['qa_content_table']} where qa_id = '$qa_id' "; $file = sql_fetch($sql); -if (!$file['qa_file'.$no]) - alert_close('파일 정보가 존재하지 않습니다.'); +if (!$file['qa_file' . $no]) + alert_close('파일 정보가 존재하지 않습니다.'); -if($is_guest) { - alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL.'/login.php?url='.urlencode(G5_BBS_URL.'/qaview.php?qa_id='.$qa_id)); +if ($is_guest) { + alert('다운로드 권한이 없습니다.\\n회원이시라면 로그인 후 이용해 보십시오.', G5_BBS_URL . '/login.php?url=' . urlencode(G5_BBS_URL . '/qaview.php?qa_id=' . $qa_id)); } -$filepath = G5_DATA_PATH.'/qa/'.$file['qa_file'.$no]; +$filepath = G5_DATA_PATH . '/qa/' . $file['qa_file' . $no]; $filepath = addslashes($filepath); if (!is_file($filepath) || !file_exists($filepath)) - alert('파일이 존재하지 않습니다.'); + alert('파일이 존재하지 않습니다.'); -$g5['title'] = '다운로드 > '.conv_subject($file['qa_subject'], 255); +$g5['title'] = '다운로드 > ' . conv_subject($file['qa_subject'], 255); -$original = urlencode($file['qa_source'.$no]); +$original = urlencode($file['qa_source' . $no]); -if(preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) { - header("content-type: doesn/matter"); - header("content-length: ".filesize("$filepath")); - header("content-disposition: attachment; filename=\"$original\""); - header("content-transfer-encoding: binary"); +if (preg_match("/msie/i", $_SERVER['HTTP_USER_AGENT']) && preg_match("/5\.5/", $_SERVER['HTTP_USER_AGENT'])) { + header("content-type: doesn/matter"); + header("content-length: " . filesize("$filepath")); + header("content-disposition: attachment; filename=\"$original\""); + header("content-transfer-encoding: binary"); } else { - header("content-type: file/unknown"); - header("content-length: ".filesize("$filepath")); - header("content-disposition: attachment; filename=\"$original\""); - header("content-description: php generated data"); + header("content-type: file/unknown"); + header("content-length: " . filesize("$filepath")); + header("content-disposition: attachment; filename=\"$original\""); + header("content-description: php generated data"); } header("pragma: no-cache"); header("expires: 0"); @@ -54,17 +54,16 @@ $fp = fopen($filepath, 'rb'); $download_rate = 10; -while(!feof($fp)) { - //echo fread($fp, 100*1024); - /* - echo fread($fp, 100*1024); - flush(); - */ +while (!feof($fp)) { + //echo fread($fp, 100*1024); + /* + echo fread($fp, 100*1024); + flush(); + */ - print fread($fp, round($download_rate * 1024)); - flush(); - usleep(1000); + print fread($fp, round($download_rate * 1024)); + flush(); + usleep(1000); } -fclose ($fp); +fclose($fp); flush(); -?> diff --git a/AvocadoEdition_Light/bbs/qahead.php b/AvocadoEdition_Light/bbs/qahead.php index e9fd0c0..e60e7f9 100644 --- a/AvocadoEdition_Light/bbs/qahead.php +++ b/AvocadoEdition_Light/bbs/qahead.php @@ -1,13 +1,13 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/qalist.php b/AvocadoEdition_Light/bbs/qalist.php index 2f5891b..8452e25 100644 --- a/AvocadoEdition_Light/bbs/qalist.php +++ b/AvocadoEdition_Light/bbs/qalist.php @@ -1,122 +1,124 @@ '; + $categories = explode('|', $qaconfig['qa_category']); // 구분자가 | 로 되어 있음 + for ($i = 0; $i < count($categories); $i++) { + $category = trim($categories[$i]); + if ($category == '') + continue; + $category_msg = ''; + $category_option .= '
  • '; + } } -if(is_file($skin_file)) { - $sql_common = " from {$g5['qa_content_table']} "; - $sql_search = " where qa_type = '0' "; +if (is_file($skin_file)) { + $sql_common = " from {$g5['qa_content_table']} "; + $sql_search = " where qa_type = '0' "; - if(!$is_admin) - $sql_search .= " and mb_id = '{$member['mb_id']}' "; + if (!$is_admin) + $sql_search .= " and mb_id = '{$member['mb_id']}' "; - if($sca) { - if (preg_match("/[a-zA-Z]/", $sca)) - $sql_search .= " and INSTR(LOWER(qa_category), LOWER('$sca')) > 0 "; - else - $sql_search .= " and INSTR(qa_category, '$sca') > 0 "; - } + if ($sca) { + if (preg_match("/[a-zA-Z]/", $sca)) + $sql_search .= " and INSTR(LOWER(qa_category), LOWER('$sca')) > 0 "; + else + $sql_search .= " and INSTR(qa_category, '$sca') > 0 "; + } - $stx = trim($stx); - if($stx) { - if (preg_match("/[a-zA-Z]/", $stx)) - $sql_search .= " and ( INSTR(LOWER(qa_subject), LOWER('$stx')) > 0 or INSTR(LOWER(qa_content), LOWER('$stx')) > 0 )"; - else - $sql_search .= " and ( INSTR(qa_subject, '$stx') > 0 or INSTR(qa_content, '$stx') > 0 ) "; - } + $stx = trim($stx); + if ($stx) { + if (preg_match("/[a-zA-Z]/", $stx)) + $sql_search .= " and ( INSTR(LOWER(qa_subject), LOWER('$stx')) > 0 or INSTR(LOWER(qa_content), LOWER('$stx')) > 0 )"; + else + $sql_search .= " and ( INSTR(qa_subject, '$stx') > 0 or INSTR(qa_content, '$stx') > 0 ) "; + } - $sql_order = " order by qa_num "; + $sql_order = " order by qa_num "; - $sql = " select count(*) as cnt + $sql = " select count(*) as cnt $sql_common $sql_search "; - $row = sql_fetch($sql); - $total_count = $row['cnt']; + $row = sql_fetch($sql); + $total_count = $row['cnt']; - $page_rows = $qaconfig['qa_page_rows']; - $total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 - if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) - $from_record = ($page - 1) * $page_rows; // 시작 열을 구함 + $page_rows = $qaconfig['qa_page_rows']; + $total_page = ceil($total_count / $page_rows); // 전체 페이지 계산 + if ($page < 1) { + $page = 1; + } // 페이지가 없으면 첫 페이지 (1 페이지) + $from_record = ($page - 1) * $page_rows; // 시작 열을 구함 - $sql = " select * + $sql = " select * $sql_common $sql_search $sql_order limit $from_record, $page_rows "; - $result = sql_query($sql); + $result = sql_query($sql); - $list = array(); - $num = $total_count - ($page - 1) * $page_rows; - $subject_len = $qaconfig['qa_subject_len']; - for($i=0; $row=sql_fetch_array($result); $i++) { - $list[$i] = $row; + $list = array(); + $num = $total_count - ($page - 1) * $page_rows; + $subject_len = $qaconfig['qa_subject_len']; + for ($i = 0; $row = sql_fetch_array($result); $i++) { + $list[$i] = $row; - $list[$i]['category'] = get_text($row['qa_category']); - $list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…'); - if ($stx) { - $list[$i]['subject'] = search_font($stx, $list[$i]['subject']); - } - - $list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr; - - $list[$i]['icon_file'] = ''; - if(trim($row['qa_file1']) || trim($row['qa_file2'])) - $list[$i]['icon_file'] = ''; - - $list[$i]['name'] = get_text($row['qa_name']); - $list[$i]['date'] = substr($row['qa_datetime'], 2, 8); - - $list[$i]['num'] = $num - $i; + $list[$i]['category'] = get_text($row['qa_category']); + $list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…'); + if ($stx) { + $list[$i]['subject'] = search_font($stx, $list[$i]['subject']); } - $is_checkbox = false; - $admin_href = ''; - if($is_admin) { - $is_checkbox = true; - $admin_href = G5_ADMIN_URL.'/qa_config.php'; - } + $list[$i]['view_href'] = G5_BBS_URL . '/qaview.php?qa_id=' . $row['qa_id'] . $qstr; - $list_href = G5_BBS_URL.'/qalist.php'; - $write_href = G5_BBS_URL.'/qawrite.php'; + $list[$i]['icon_file'] = ''; + if (trim($row['qa_file1']) || trim($row['qa_file2'])) + $list[$i]['icon_file'] = ''; - $list_pages = preg_replace('/(\.php)(&|&)/i', '$1?', get_paging($qaconfig['qa_page_rows'], $page, $total_page, './qalist.php'.$qstr.'&page=')); + $list[$i]['name'] = get_text($row['qa_name']); + $list[$i]['date'] = substr($row['qa_datetime'], 2, 8); - $stx = get_text(stripslashes($stx)); - include_once($skin_file); + $list[$i]['num'] = $num - $i; + } + + $is_checkbox = false; + $admin_href = ''; + if ($is_admin) { + $is_checkbox = true; + $admin_href = G5_ADMIN_URL . '/qa_config.php'; + } + + $list_href = G5_BBS_URL . '/qalist.php'; + $write_href = G5_BBS_URL . '/qawrite.php'; + + $list_pages = preg_replace('/(\.php)(&|&)/i', '$1?', get_paging($qaconfig['qa_page_rows'], $page, $total_page, './qalist.php' . $qstr . '&page=')); + + $stx = get_text(stripslashes($stx)); + include_once($skin_file); } else { - echo '
    '.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.
    '; + echo '
    ' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.
    '; } include_once('./qatail.php'); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/qatail.php b/AvocadoEdition_Light/bbs/qatail.php index 8cc00e1..56c4e1e 100644 --- a/AvocadoEdition_Light/bbs/qatail.php +++ b/AvocadoEdition_Light/bbs/qatail.php @@ -1,15 +1,15 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/qaview.php b/AvocadoEdition_Light/bbs/qaview.php index f6b2944..6e3a4e1 100644 --- a/AvocadoEdition_Light/bbs/qaview.php +++ b/AvocadoEdition_Light/bbs/qaview.php @@ -2,174 +2,173 @@ include_once('./_common.php'); include_once(G5_EDITOR_LIB); -if($is_guest) - alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qaview.php?qa_id='.$qa_id)); +if ($is_guest) + alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url=' . urlencode(G5_BBS_URL . '/qaview.php?qa_id=' . $qa_id)); $qaconfig = get_qa_config(); $g5['title'] = $qaconfig['qa_title']; include_once('./qahead.php'); -$skin_file = $qa_skin_path.'/view.skin.php'; +$skin_file = $qa_skin_path . '/view.skin.php'; -if(is_file($skin_file)) { - $sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' "; - if(!$is_admin) { - $sql .= " and mb_id = '{$member['mb_id']}' "; - } +if (is_file($skin_file)) { + $sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' "; + if (!$is_admin) { + $sql .= " and mb_id = '{$member['mb_id']}' "; + } - $view = sql_fetch($sql); + $view = sql_fetch($sql); - if(!$view['qa_id']) - alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.'); + if (!$view['qa_id']) + alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.'); - $subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len']; + $subject_len = G5_IS_MOBILE ? $qaconfig['qa_mobile_subject_len'] : $qaconfig['qa_subject_len']; - $view['category'] = get_text($view['qa_category']); - $view['subject'] = conv_subject($view['qa_subject'], $subject_len, '…'); - $view['content'] = conv_content($view['qa_content'], $view['qa_html']); - $view['name'] = get_text($view['qa_name']); - $view['datetime'] = $view['qa_datetime']; - $view['email'] = get_text(get_email_address($view['qa_email'])); - $view['hp'] = $view['qa_hp']; + $view['category'] = get_text($view['qa_category']); + $view['subject'] = conv_subject($view['qa_subject'], $subject_len, '…'); + $view['content'] = conv_content($view['qa_content'], $view['qa_html']); + $view['name'] = get_text($view['qa_name']); + $view['datetime'] = $view['qa_datetime']; + $view['email'] = get_text(get_email_address($view['qa_email'])); + $view['hp'] = $view['qa_hp']; - if (trim($stx)) + if (trim($stx)) $view['subject'] = search_font($stx, $view['subject']); - if (trim($stx)) - $view['content'] = search_font($stx, $view['content']); + if (trim($stx)) + $view['content'] = search_font($stx, $view['content']); - // 이전글, 다음글 - $sql = " select qa_id, qa_subject + // 이전글, 다음글 + $sql = " select qa_id, qa_subject from {$g5['qa_content_table']} where qa_type = '0' "; - if(!$is_admin) { - $sql .= " and mb_id = '{$member['mb_id']}' "; - } + if (!$is_admin) { + $sql .= " and mb_id = '{$member['mb_id']}' "; + } - // 이전글 - $prev_search = " and qa_num < '{$view['qa_num']}' order by qa_num desc limit 1 "; - $prev = sql_fetch($sql.$prev_search); + // 이전글 + $prev_search = " and qa_num < '{$view['qa_num']}' order by qa_num desc limit 1 "; + $prev = sql_fetch($sql . $prev_search); - $prev_href = ''; - if (isset($prev['qa_id']) && $prev['qa_id']) { - $prev_qa_subject = get_text(cut_str($prev['qa_subject'], 255)); - $prev_href = G5_BBS_URL.'/qaview.php?qa_id='.$prev['qa_id'].$qstr; - } + $prev_href = ''; + if (isset($prev['qa_id']) && $prev['qa_id']) { + $prev_qa_subject = get_text(cut_str($prev['qa_subject'], 255)); + $prev_href = G5_BBS_URL . '/qaview.php?qa_id=' . $prev['qa_id'] . $qstr; + } - // 다음글 - $next_search = " and qa_num > '{$view['qa_num']}' order by qa_num asc limit 1 "; - $next = sql_fetch($sql.$next_search); + // 다음글 + $next_search = " and qa_num > '{$view['qa_num']}' order by qa_num asc limit 1 "; + $next = sql_fetch($sql . $next_search); - $next_href = ''; - if (isset($next['qa_id']) && $next['qa_id']) { - $next_qa_subject = get_text(cut_str($next['qa_subject'], 255)); - $next_href = G5_BBS_URL.'/qaview.php?qa_id='.$next['qa_id'].$qstr; - } + $next_href = ''; + if (isset($next['qa_id']) && $next['qa_id']) { + $next_qa_subject = get_text(cut_str($next['qa_subject'], 255)); + $next_href = G5_BBS_URL . '/qaview.php?qa_id=' . $next['qa_id'] . $qstr; + } - // 관련질문 - $rows = 10; - $sql = " select * + // 관련질문 + $rows = 10; + $sql = " select * from {$g5['qa_content_table']} where qa_id <> '$qa_id' and qa_related = '{$view['qa_related']}' and qa_type = '0' order by qa_num, qa_type limit 0, $rows "; - $result = sql_query($sql); + $result = sql_query($sql); - $rel_list = array(); - $rel_count = 0; - for($i=0; $row=sql_fetch_array($result); $i++) { - $rel_list[$i] = $row; - $rel_list[$i]['category'] = get_text($row['qa_category']); - $rel_list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…'); - $rel_list[$i]['name'] = get_text($row['qa_name']); - $rel_list[$i]['date'] = substr($row['qa_datetime'], 2, 8); - $rel_list[$i]['view_href'] = G5_BBS_URL.'/qaview.php?qa_id='.$row['qa_id'].$qstr; - $rel_count++; - } - $view['rel_count'] = $rel_count; + $rel_list = array(); + $rel_count = 0; + for ($i = 0; $row = sql_fetch_array($result); $i++) { + $rel_list[$i] = $row; + $rel_list[$i]['category'] = get_text($row['qa_category']); + $rel_list[$i]['subject'] = conv_subject($row['qa_subject'], $subject_len, '…'); + $rel_list[$i]['name'] = get_text($row['qa_name']); + $rel_list[$i]['date'] = substr($row['qa_datetime'], 2, 8); + $rel_list[$i]['view_href'] = G5_BBS_URL . '/qaview.php?qa_id=' . $row['qa_id'] . $qstr; + $rel_count++; + } + $view['rel_count'] = $rel_count; - $update_href = ''; - $delete_href = ''; - $write_href = G5_BBS_URL.'/qawrite.php'; - $rewrite_href = G5_BBS_URL.'/qawrite.php?w=r&qa_id='.$view['qa_id']; - $list_href = G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr); + $update_href = ''; + $delete_href = ''; + $write_href = G5_BBS_URL . '/qawrite.php'; + $rewrite_href = G5_BBS_URL . '/qawrite.php?w=r&qa_id=' . $view['qa_id']; + $list_href = G5_BBS_URL . '/qalist.php' . preg_replace('/^&/', '?', $qstr); - /* - if($view['qa_type']) { - if($is_admin) - $update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr; - } else { - if($view['qa_status'] == 0) - $update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr; - } - */ - if(($view['qa_type'] && $is_admin) || (!$view['qa_type'] && $view['qa_status'] == 0)) { - $update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr; - $delete_href = G5_BBS_URL.'/qadelete.php?qa_id='.$view['qa_id'].$qstr; - } + /* + if($view['qa_type']) { + if($is_admin) + $update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr; + } else { + if($view['qa_status'] == 0) + $update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$view['qa_id'].$qstr; + } + */ + if (($view['qa_type'] && $is_admin) || (!$view['qa_type'] && $view['qa_status'] == 0)) { + $update_href = G5_BBS_URL . '/qawrite.php?w=u&qa_id=' . $view['qa_id'] . $qstr; + $delete_href = G5_BBS_URL . '/qadelete.php?qa_id=' . $view['qa_id'] . $qstr; + } - // 질문글이고 등록된 답변이 있다면 - $answer = array(); - $answer_update_href = ''; - $answer_delete_href = ''; - if(!$view['qa_type'] && $view['qa_status']) { - $sql = " select * + // 질문글이고 등록된 답변이 있다면 + $answer = array(); + $answer_update_href = ''; + $answer_delete_href = ''; + if (!$view['qa_type'] && $view['qa_status']) { + $sql = " select * from {$g5['qa_content_table']} where qa_type = '1' and qa_parent = '{$view['qa_id']}' "; - $answer = sql_fetch($sql); + $answer = sql_fetch($sql); - if($is_admin) { - $answer_update_href = G5_BBS_URL.'/qawrite.php?w=u&qa_id='.$answer['qa_id'].$qstr; - $answer_delete_href = G5_BBS_URL.'/qadelete.php?qa_id='.$answer['qa_id'].$qstr; - } + if ($is_admin) { + $answer_update_href = G5_BBS_URL . '/qawrite.php?w=u&qa_id=' . $answer['qa_id'] . $qstr; + $answer_delete_href = G5_BBS_URL . '/qadelete.php?qa_id=' . $answer['qa_id'] . $qstr; + } + } + + $stx = get_text(stripslashes($stx)); + + $is_dhtml_editor = false; + // 모바일에서는 DHTML 에디터 사용불가 + if ($config['cf_editor'] && $qaconfig['qa_use_editor'] && !G5_IS_MOBILE) { + $is_dhtml_editor = true; + } + $editor_html = editor_html('qa_content', $content, $is_dhtml_editor); + $editor_js = ''; + $editor_js .= get_editor_js('qa_content', $is_dhtml_editor); + $editor_js .= chk_editor_js('qa_content', $is_dhtml_editor); + + $ss_name = 'ss_qa_view_' . $qa_id; + if (!get_session($ss_name)) + set_session($ss_name, TRUE); + + // 첨부파일 + $view['img_file'] = array(); + $view['download_href'] = array(); + $view['download_source'] = array(); + $view['img_count'] = 0; + $view['download_count'] = 0; + + for ($i = 1; $i <= 2; $i++) { + if (preg_match("/\.({$config['cf_image_extension']})$/i", $view['qa_file' . $i])) { + $view['img_file'][] = '
    '; + $view['img_count']++; + continue; } - $stx = get_text(stripslashes($stx)); - - $is_dhtml_editor = false; - // 모바일에서는 DHTML 에디터 사용불가 - if ($config['cf_editor'] && $qaconfig['qa_use_editor'] && !G5_IS_MOBILE) { - $is_dhtml_editor = true; + if ($view['qa_file' . $i]) { + $view['download_href'][] = G5_BBS_URL . '/qadownload.php?qa_id=' . $view['qa_id'] . '&no=' . $i; + $view['download_source'][] = $view['qa_source' . $i]; + $view['download_count']++; } - $editor_html = editor_html('qa_content', $content, $is_dhtml_editor); - $editor_js = ''; - $editor_js .= get_editor_js('qa_content', $is_dhtml_editor); - $editor_js .= chk_editor_js('qa_content', $is_dhtml_editor); + } - $ss_name = 'ss_qa_view_'.$qa_id; - if(!get_session($ss_name)) - set_session($ss_name, TRUE); - - // 첨부파일 - $view['img_file'] = array(); - $view['download_href'] = array(); - $view['download_source'] = array(); - $view['img_count'] = 0; - $view['download_count'] = 0; - - for ($i=1; $i<=2; $i++) { - if(preg_match("/\.({$config['cf_image_extension']})$/i", $view['qa_file'.$i])) { - $view['img_file'][] = ''; - $view['img_count']++; - continue; - } - - if ($view['qa_file'.$i]) { - $view['download_href'][] = G5_BBS_URL.'/qadownload.php?qa_id='.$view['qa_id'].'&no='.$i; - $view['download_source'][] = $view['qa_source'.$i]; - $view['download_count']++; - } - } - - include_once($skin_file); + include_once($skin_file); } else { - echo '
    '.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.
    '; + echo '
    ' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.
    '; } include_once('./qatail.php'); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/qawrite.php b/AvocadoEdition_Light/bbs/qawrite.php index d9ffd7b..4809807 100644 --- a/AvocadoEdition_Light/bbs/qawrite.php +++ b/AvocadoEdition_Light/bbs/qawrite.php @@ -2,137 +2,137 @@ include_once('./_common.php'); include_once(G5_EDITOR_LIB); -if($w != '' && $w != 'u' && $w != 'r') { - alert('올바른 방법으로 이용해 주십시오.'); +if ($w != '' && $w != 'u' && $w != 'r') { + alert('올바른 방법으로 이용해 주십시오.'); } -if($is_guest) - alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qalist.php')); +if ($is_guest) + alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url=' . urlencode(G5_BBS_URL . '/qalist.php')); $qaconfig = get_qa_config(); $g5['title'] = $qaconfig['qa_title']; include_once('./qahead.php'); -$skin_file = $qa_skin_path.'/write.skin.php'; +$skin_file = $qa_skin_path . '/write.skin.php'; -if(is_file($skin_file)) { - /*========================== - $w == a : 답변 - $w == r : 추가질문 - $w == u : 수정 - ==========================*/ +if (is_file($skin_file)) { + /*========================== + $w == a : 답변 + $w == r : 추가질문 + $w == u : 수정 + ==========================*/ - if($w == 'u' || $w == 'r') { - $sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' "; - if(!$is_admin) { - $sql .= " and mb_id = '{$member['mb_id']}' "; - } - - $write = sql_fetch($sql); - - if($w == 'u') { - if(!$write['qa_id']) - alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.'); - - if(!$is_admin) { - if($write['qa_type'] == 0 && $write['qa_status'] == 1) - alert('답변이 등록된 문의글은 수정할 수 없습니다.'); - - if($write['mb_id'] != $member['mb_id']) - alert('게시글을 수정할 권한이 없습니다.\\n\\n올바른 방법으로 이용해 주십시오.', G5_URL); - } - } + if ($w == 'u' || $w == 'r') { + $sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' "; + if (!$is_admin) { + $sql .= " and mb_id = '{$member['mb_id']}' "; } - // 분류 - $category_option = ''; - if(trim($qaconfig['qa_category'])) { - $category = explode('|', $qaconfig['qa_category']); - for($i=0; $i'.str_replace(G5_PATH.'/', '', $skin_file).'이 존재하지 않습니다.'; + echo '
    ' . str_replace(G5_PATH . '/', '', $skin_file) . '이 존재하지 않습니다.
    '; } include_once('./qatail.php'); -?> \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/bbs/qawrite_update.php b/AvocadoEdition_Light/bbs/qawrite_update.php index b00d082..ce1dd71 100644 --- a/AvocadoEdition_Light/bbs/qawrite_update.php +++ b/AvocadoEdition_Light/bbs/qawrite_update.php @@ -7,236 +7,237 @@ $w == r : 추가질문 $w == u : 수정 ==========================*/ -if($is_guest) - alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url='.urlencode(G5_BBS_URL.'/qalist.php')); +if ($is_guest) + alert('회원이시라면 로그인 후 이용해 보십시오.', './login.php?url=' . urlencode(G5_BBS_URL . '/qalist.php')); $msg = array(); // 1:1문의 설정값 $qaconfig = get_qa_config(); -if(trim($qaconfig['qa_category'])) { - if($w != 'a') { - $category = explode('|', $qaconfig['qa_category']); - if(!in_array($qa_category, $category)) - alert('분류를 올바르게 지정해 주십시오.'); - } +if (trim($qaconfig['qa_category'])) { + if ($w != 'a') { + $category = explode('|', $qaconfig['qa_category']); + if (!in_array($qa_category, $category)) + alert('분류를 올바르게 지정해 주십시오.'); + } } else { - alert('1:1문의 설정에서 분류를 설정해 주십시오'); + alert('1:1문의 설정에서 분류를 설정해 주십시오'); } // e-mail 체크 $qa_email = ''; -if(isset($_POST['qa_email']) && $_POST['qa_email']) - $qa_email = get_email_address(trim($_POST['qa_email'])); +if (isset($_POST['qa_email']) && $_POST['qa_email']) + $qa_email = get_email_address(trim($_POST['qa_email'])); -if($w != 'a' && $qaconfig['qa_req_email'] && !$qa_email) - $msg[] = '이메일을 입력하세요.'; +if ($w != 'a' && $qaconfig['qa_req_email'] && !$qa_email) + $msg[] = '이메일을 입력하세요.'; $qa_subject = ''; if (isset($_POST['qa_subject'])) { - $qa_subject = substr(trim($_POST['qa_subject']),0,255); - $qa_subject = preg_replace("#[\\\]+$#", "", $qa_subject); + $qa_subject = substr(trim($_POST['qa_subject']), 0, 255); + $qa_subject = preg_replace("#[\\\]+$#", "", $qa_subject); } if ($qa_subject == '') { - $msg[] = '제목을 입력하세요.'; + $msg[] = '제목을 입력하세요.'; } $qa_content = ''; if (isset($_POST['qa_content'])) { - $qa_content = substr(trim($_POST['qa_content']),0,65536); - $qa_content = preg_replace("#[\\\]+$#", "", $qa_content); + $qa_content = substr(trim($_POST['qa_content']), 0, 65536); + $qa_content = preg_replace("#[\\\]+$#", "", $qa_content); } if ($qa_content == '') { - $msg[] = '내용을 입력하세요.'; + $msg[] = '내용을 입력하세요.'; } if (!empty($msg)) { - $msg = implode('
    ', $msg); - alert($msg); + $msg = implode('
    ', $msg); + alert($msg); } -if($qa_hp) - $qa_hp = preg_replace('/[^0-9\-]/', '', strip_tags($qa_hp)); +if ($qa_hp) + $qa_hp = preg_replace('/[^0-9\-]/', '', strip_tags($qa_hp)); // 090710 if (substr_count($qa_content, '&#') > 50) { - alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); - exit; + alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); + exit; } $upload_max_filesize = ini_get('upload_max_filesize'); if (empty($_POST)) { - alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n게시판관리자 또는 서버관리자에게 문의 바랍니다."); + alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=" . ini_get('post_max_size') . " , upload_max_filesize=" . $upload_max_filesize . "\\n게시판관리자 또는 서버관리자에게 문의 바랍니다."); } -for ($i=1; $i<=5; $i++) { - $var = "qa_$i"; - $$var = ""; - if (isset($_POST['qa_'.$i]) && $_POST['qa_'.$i]) { - $$var = trim($_POST['qa_'.$i]); - } +for ($i = 1; $i <= 5; $i++) { + $var = "qa_$i"; + $$var = ""; + if (isset($_POST['qa_' . $i]) && $_POST['qa_' . $i]) { + $$var = trim($_POST['qa_' . $i]); + } } -if($w == 'u' || $w == 'a' || $w == 'r') { - if($w == 'a' && !$is_admin) - alert('답변은 관리자만 등록할 수 있습니다.'); +if ($w == 'u' || $w == 'a' || $w == 'r') { + if ($w == 'a' && !$is_admin) + alert('답변은 관리자만 등록할 수 있습니다.'); - $sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' "; - if(!$is_admin) { - $sql .= " and mb_id = '{$member['mb_id']}' "; + $sql = " select * from {$g5['qa_content_table']} where qa_id = '$qa_id' "; + if (!$is_admin) { + $sql .= " and mb_id = '{$member['mb_id']}' "; + } + + $write = sql_fetch($sql); + + if ($w == 'u') { + if (!$write['qa_id']) + alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.'); + + if (!$is_admin) { + if ($write['qa_type'] == 0 && $write['qa_status'] == 1) + alert('답변이 등록된 문의글은 수정할 수 없습니다.'); + + if ($write['mb_id'] != $member['mb_id']) + alert('게시글을 수정할 권한이 없습니다.\\n\\n올바른 방법으로 이용해 주십시오.', G5_URL); } + } - $write = sql_fetch($sql); + if ($w == 'a') { + if (!$write['qa_id']) + alert('문의글이 존재하지 않아 답변글을 등록할 수 없습니다.'); - if($w == 'u') { - if(!$write['qa_id']) - alert('게시글이 존재하지 않습니다.\\n삭제되었거나 자신의 글이 아닌 경우입니다.'); - - if(!$is_admin) { - if($write['qa_type'] == 0 && $write['qa_status'] == 1) - alert('답변이 등록된 문의글은 수정할 수 없습니다.'); - - if($write['mb_id'] != $member['mb_id']) - alert('게시글을 수정할 권한이 없습니다.\\n\\n올바른 방법으로 이용해 주십시오.', G5_URL); - } - } - - if($w == 'a') { - if(!$write['qa_id']) - alert('문의글이 존재하지 않아 답변글을 등록할 수 없습니다.'); - - if($write['qa_type'] == 1) - alert('답변글에는 다시 답변을 등록할 수 없습니다.'); - } + if ($write['qa_type'] == 1) + alert('답변글에는 다시 답변을 등록할 수 없습니다.'); + } } // 파일개수 체크 -$file_count = 0; +$file_count = 0; $upload_count = count($_FILES['bf_file']['name']); -for ($i=1; $i<=$upload_count; $i++) { - if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i])) - $file_count++; +for ($i = 1; $i <= $upload_count; $i++) { + if ($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i])) + $file_count++; } -if($file_count > 2) - alert('첨부파일을 2개 이하로 업로드 해주십시오.'); +if ($file_count > 2) + alert('첨부파일을 2개 이하로 업로드 해주십시오.'); // 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.) -@mkdir(G5_DATA_PATH.'/qa', G5_DIR_PERMISSION); -@chmod(G5_DATA_PATH.'/qa', G5_DIR_PERMISSION); +@mkdir(G5_DATA_PATH . '/qa', G5_DIR_PERMISSION); +@chmod(G5_DATA_PATH . '/qa', G5_DIR_PERMISSION); -$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z')); +$chars_array = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z')); // 가변 파일 업로드 $file_upload_msg = ''; $upload = array(); -for ($i=1; $i<=count($_FILES['bf_file']['name']); $i++) { - $upload[$i]['file'] = ''; - $upload[$i]['source'] = ''; - $upload[$i]['del_check'] = false; +for ($i = 1; $i <= count($_FILES['bf_file']['name']); $i++) { + $upload[$i]['file'] = ''; + $upload[$i]['source'] = ''; + $upload[$i]['del_check'] = false; - // 삭제에 체크가 되어있다면 파일을 삭제합니다. - if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) { - $upload[$i]['del_check'] = true; - @unlink(G5_DATA_PATH.'/qa/'.$write['qa_file'.$i]); - // 썸네일삭제 - if(preg_match("/\.({$config['cf_image_extension']})$/i", $write['qa_file'.$i])) { - delete_qa_thumbnail($write['qa_file'.$i]); - } + // 삭제에 체크가 되어있다면 파일을 삭제합니다. + if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) { + $upload[$i]['del_check'] = true; + @unlink(G5_DATA_PATH . '/qa/' . $write['qa_file' . $i]); + // 썸네일삭제 + if (preg_match("/\.({$config['cf_image_extension']})$/i", $write['qa_file' . $i])) { + delete_qa_thumbnail($write['qa_file' . $i]); + } + } + + $tmp_file = $_FILES['bf_file']['tmp_name'][$i]; + $filesize = $_FILES['bf_file']['size'][$i]; + $filename = $_FILES['bf_file']['name'][$i]; + $filename = get_safe_filename($filename); + + // 서버에 설정된 값보다 큰파일을 업로드 한다면 + if ($filename) { + if ($_FILES['bf_file']['error'][$i] == 1) { + $file_upload_msg .= '\"' . $filename . '\" 파일의 용량이 서버에 설정(' . $upload_max_filesize . ')된 값보다 크므로 업로드 할 수 없습니다.\\n'; + continue; + } else if ($_FILES['bf_file']['error'][$i] != 0) { + $file_upload_msg .= '\"' . $filename . '\" 파일이 정상적으로 업로드 되지 않았습니다.\\n'; + continue; + } + } + + if (is_uploaded_file($tmp_file)) { + // 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀 + if (!$is_admin && $filesize > $qaconfig['qa_upload_size']) { + $file_upload_msg .= '\"' . $filename . '\" 파일의 용량(' . number_format($filesize) . ' 바이트)이 게시판에 설정(' . number_format($qaconfig['qa_upload_size']) . ' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n'; + continue; } - $tmp_file = $_FILES['bf_file']['tmp_name'][$i]; - $filesize = $_FILES['bf_file']['size'][$i]; - $filename = $_FILES['bf_file']['name'][$i]; - $filename = get_safe_filename($filename); + //=================================================================\ + // 090714 + // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 + // 에러메세지는 출력하지 않는다. + //----------------------------------------------------------------- + $timg = @getimagesize($tmp_file); + // image type + if ( + preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || + preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) + ) { + if ($timg['2'] < 1 || $timg['2'] > 16) + continue; + } + //================================================================= - // 서버에 설정된 값보다 큰파일을 업로드 한다면 - if ($filename) { - if ($_FILES['bf_file']['error'][$i] == 1) { - $file_upload_msg .= '\"'.$filename.'\" 파일의 용량이 서버에 설정('.$upload_max_filesize.')된 값보다 크므로 업로드 할 수 없습니다.\\n'; - continue; - } - else if ($_FILES['bf_file']['error'][$i] != 0) { - $file_upload_msg .= '\"'.$filename.'\" 파일이 정상적으로 업로드 되지 않았습니다.\\n'; - continue; - } + if ($w == 'u') { + // 존재하는 파일이 있다면 삭제합니다. + @unlink(G5_DATA_PATH . '/qa/' . $write['qa_file' . $i]); + // 이미지파일이면 썸네일삭제 + if (preg_match("/\.({$config['cf_image_extension']})$/i", $write['qa_file' . $i])) { + delete_qa_thumbnail($row['qa_file' . $i]); + } } - if (is_uploaded_file($tmp_file)) { - // 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀 - if (!$is_admin && $filesize > $qaconfig['qa_upload_size']) { - $file_upload_msg .= '\"'.$filename.'\" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($qaconfig['qa_upload_size']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n'; - continue; - } + // 프로그램 원래 파일명 + $upload[$i]['source'] = $filename; + $upload[$i]['filesize'] = $filesize; - //=================================================================\ - // 090714 - // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 - // 에러메세지는 출력하지 않는다. - //----------------------------------------------------------------- - $timg = @getimagesize($tmp_file); - // image type - if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || - preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) { - if ($timg['2'] < 1 || $timg['2'] > 16) - continue; - } - //================================================================= + // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 + $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); - if ($w == 'u') { - // 존재하는 파일이 있다면 삭제합니다. - @unlink(G5_DATA_PATH.'/qa/'.$write['qa_file'.$i]); - // 이미지파일이면 썸네일삭제 - if(preg_match("/\.({$config['cf_image_extension']})$/i", $write['qa_file'.$i])) { - delete_qa_thumbnail($row['qa_file'.$i]); - } - } + shuffle($chars_array); + $shuffle = implode('', $chars_array); - // 프로그램 원래 파일명 - $upload[$i]['source'] = $filename; - $upload[$i]['filesize'] = $filesize; + // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) + $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])) . '_' . substr($shuffle, 0, 8) . '_' . replace_filename($filename); - // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 - $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); + $dest_file = G5_DATA_PATH . '/qa/' . $upload[$i]['file']; - shuffle($chars_array); - $shuffle = implode('', $chars_array); + // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. + $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]); - // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) - $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename); - - $dest_file = G5_DATA_PATH.'/qa/'.$upload[$i]['file']; - - // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. - $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]); - - // 올라간 파일의 퍼미션을 변경합니다. - chmod($dest_file, G5_FILE_PERMISSION); - } + // 올라간 파일의 퍼미션을 변경합니다. + chmod($dest_file, G5_FILE_PERMISSION); + } } -if($w == '' || $w == 'a' || $w == 'r') { - if($w == '' || $w == 'r') { - $row = sql_fetch(" select MIN(qa_num) as min_qa_num from {$g5['qa_content_table']} "); - $qa_num = $row['min_qa_num'] - 1; - } +if ($w == '' || $w == 'a' || $w == 'r') { + if ($w == '' || $w == 'r') { + $row = sql_fetch(" select MIN(qa_num) as min_qa_num from {$g5['qa_content_table']} "); + $qa_num = $row['min_qa_num'] - 1; + } - if($w == 'a') { - $qa_num = $write['qa_num']; - $qa_parent = $write['qa_id']; - $qa_related = $write['qa_related']; - $qa_category = $write['qa_category']; - $qa_type = 1; - $qa_status = 1; - } + if ($w == 'a') { + $qa_num = $write['qa_num']; + $qa_parent = $write['qa_id']; + $qa_related = $write['qa_related']; + $qa_category = $write['qa_category']; + $qa_type = 1; + $qa_status = 1; + } - $sql = " insert into {$g5['qa_content_table']} + $sql = " insert into {$g5['qa_content_table']} set qa_num = '$qa_num', mb_id = '{$member['mb_id']}', - qa_name = '".addslashes($member['mb_nick'])."', + qa_name = '" . addslashes($member['mb_nick']) . "', qa_email = '$qa_email', qa_hp = '$qa_hp', qa_type = '$qa_type', @@ -254,48 +255,48 @@ if($w == '' || $w == 'a' || $w == 'r') { qa_file2 = '{$upload[2]['file']}', qa_source2 = '{$upload[2]['source']}', qa_ip = '{$_SERVER['REMOTE_ADDR']}', - qa_datetime = '".G5_TIME_YMDHIS."', + qa_datetime = '" . G5_TIME_YMDHIS . "', qa_1 = '$qa_1', qa_2 = '$qa_2', qa_3 = '$qa_3', qa_4 = '$qa_4', qa_5 = '$qa_5' "; - sql_query($sql); + sql_query($sql); - if($w == '' || $w == 'r') { - $qa_id = sql_insert_id(); + if ($w == '' || $w == 'r') { + $qa_id = sql_insert_id(); - if($w == 'r' && $write['qa_related']) { - $qa_related = $write['qa_related']; - } else { - $qa_related = $qa_id; - } - - $sql = " update {$g5['qa_content_table']} - set qa_parent = '$qa_id', - qa_related = '$qa_related' - where qa_id = '$qa_id' "; - sql_query($sql); - } - - if($w == 'a') { - $sql = " update {$g5['qa_content_table']} - set qa_status = '1' - where qa_id = '{$write['qa_parent']}' "; - sql_query($sql); - } -} else if($w == 'u') { - if(!$upload[1]['file'] && !$upload[1]['del_check']) { - $upload[1]['file'] = $write['qa_file1']; - $upload[1]['source'] = $write['qa_source1']; - } - - if(!$upload[2]['file'] && !$upload[2]['del_check']) { - $upload[2]['file'] = $write['qa_file2']; - $upload[2]['source'] = $write['qa_source2']; + if ($w == 'r' && $write['qa_related']) { + $qa_related = $write['qa_related']; + } else { + $qa_related = $qa_id; } $sql = " update {$g5['qa_content_table']} + set qa_parent = '$qa_id', + qa_related = '$qa_related' + where qa_id = '$qa_id' "; + sql_query($sql); + } + + if ($w == 'a') { + $sql = " update {$g5['qa_content_table']} + set qa_status = '1' + where qa_id = '{$write['qa_parent']}' "; + sql_query($sql); + } +} else if ($w == 'u') { + if (!$upload[1]['file'] && !$upload[1]['del_check']) { + $upload[1]['file'] = $write['qa_file1']; + $upload[1]['source'] = $write['qa_source1']; + } + + if (!$upload[2]['file'] && !$upload[2]['del_check']) { + $upload[2]['file'] = $write['qa_file2']; + $upload[2]['source'] = $write['qa_source2']; + } + + $sql = " update {$g5['qa_content_table']} set qa_email = '$qa_email', qa_hp = '$qa_hp', qa_category = '$qa_category', @@ -311,141 +312,141 @@ if($w == '' || $w == 'a' || $w == 'r') { qa_3 = '$qa_3', qa_4 = '$qa_4', qa_5 = '$qa_5' "; - if($qa_sms_recv) - $sql .= ", qa_sms_recv = '$qa_sms_recv' "; - $sql .= " where qa_id = '$qa_id' "; - sql_query($sql); + if ($qa_sms_recv) + $sql .= ", qa_sms_recv = '$qa_sms_recv' "; + $sql .= " where qa_id = '$qa_id' "; + sql_query($sql); } // SMS 알림 -if($config['cf_sms_use'] == 'icode' && $qaconfig['qa_use_sms']) { - if($config['cf_sms_type'] == 'LMS') { - include_once(G5_LIB_PATH.'/icode.lms.lib.php'); +if ($config['cf_sms_use'] == 'icode' && $qaconfig['qa_use_sms']) { + if ($config['cf_sms_type'] == 'LMS') { + include_once(G5_LIB_PATH . '/icode.lms.lib.php'); - $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']); + $port_setting = get_icode_port_type($config['cf_icode_id'], $config['cf_icode_pw']); - // SMS 모듈 클래스 생성 - if($port_setting !== false) { - // 답변글은 질문 등록자에게 전송 - if($w == 'a' && $write['qa_sms_recv'] && trim($write['qa_hp'])) { - $sms_content = $config['cf_title'].' '.$qaconfig['qa_title'].'에 답변이 등록되었습니다.'; - $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); - $recv_number = preg_replace('/[^0-9]/', '', $write['qa_hp']); + // SMS 모듈 클래스 생성 + if ($port_setting !== false) { + // 답변글은 질문 등록자에게 전송 + if ($w == 'a' && $write['qa_sms_recv'] && trim($write['qa_hp'])) { + $sms_content = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . '에 답변이 등록되었습니다.'; + $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); + $recv_number = preg_replace('/[^0-9]/', '', $write['qa_hp']); - if($recv_number) { - $strDest = array(); - $strDest[] = $recv_number; - $strCallBack = $send_number; - $strCaller = iconv_euckr(trim($config['cf_title'])); - $strSubject = ''; - $strURL = ''; - $strData = iconv_euckr($sms_content); - $strDate = ''; - $nCount = count($strDest); + if ($recv_number) { + $strDest = array(); + $strDest[] = $recv_number; + $strCallBack = $send_number; + $strCaller = iconv_euckr(trim($config['cf_title'])); + $strSubject = ''; + $strURL = ''; + $strData = iconv_euckr($sms_content); + $strDate = ''; + $nCount = count($strDest); - $SMS = new LMS; - $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting); - $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount); + $SMS = new LMS; + $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting); + $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount); - if($res) { - $SMS->Send(); - } + if ($res) { + $SMS->Send(); + } - $SMS->Init(); // 보관하고 있던 결과값을 지웁니다. - } - } - - // 문의글 등록시 관리자에게 전송 - if(($w == '' || $w == 'r') && trim($qaconfig['qa_admin_hp'])) { - $sms_content = $config['cf_title'].' '.$qaconfig['qa_title'].'에 문의글이 등록되었습니다.'; - $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); - $recv_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_admin_hp']); - - if($recv_number) { - $strDest = array(); - $strDest[] = $recv_number; - $strCallBack = $send_number; - $strCaller = iconv_euckr(trim($config['cf_title']));; - $strSubject = ''; - $strURL = ''; - $strData = iconv_euckr($sms_content); - $strDate = ''; - $nCount = count($strDest); - - $SMS = new LMS; - $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting); - $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount); - - if($res) { - $SMS->Send(); - } - - $SMS->Init(); // 보관하고 있던 결과값을 지웁니다. - } - } + $SMS->Init(); // 보관하고 있던 결과값을 지웁니다. } - } else { - include_once(G5_LIB_PATH.'/icode.sms.lib.php'); + } - // 답변글은 질문 등록자에게 전송 - if($w == 'a' && $write['qa_sms_recv'] && trim($write['qa_hp'])) { - $sms_content = $config['cf_title'].' '.$qaconfig['qa_title'].'에 답변이 등록되었습니다.'; - $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); - $recv_number = preg_replace('/[^0-9]/', '', $write['qa_hp']); + // 문의글 등록시 관리자에게 전송 + if (($w == '' || $w == 'r') && trim($qaconfig['qa_admin_hp'])) { + $sms_content = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . '에 문의글이 등록되었습니다.'; + $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); + $recv_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_admin_hp']); - if($recv_number) { - $SMS = new SMS; // SMS 연결 - $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']); - $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), ""); - $SMS->Send(); - } - } - - // 문의글 등록시 관리자에게 전송 - if(($w == '' || $w == 'r') && trim($qaconfig['qa_admin_hp'])) { - $sms_content = $config['cf_title'].' '.$qaconfig['qa_title'].'에 문의글이 등록되었습니다.'; - $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); - $recv_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_admin_hp']); - - if($recv_number) { - $SMS = new SMS; // SMS 연결 - $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']); - $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), ""); - $SMS->Send(); - } + if ($recv_number) { + $strDest = array(); + $strDest[] = $recv_number; + $strCallBack = $send_number; + $strCaller = iconv_euckr(trim($config['cf_title'])); + ; + $strSubject = ''; + $strURL = ''; + $strData = iconv_euckr($sms_content); + $strDate = ''; + $nCount = count($strDest); + + $SMS = new LMS; + $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $port_setting); + $res = $SMS->Add($strDest, $strCallBack, $strCaller, $strSubject, $strURL, $strData, $strDate, $nCount); + + if ($res) { + $SMS->Send(); + } + + $SMS->Init(); // 보관하고 있던 결과값을 지웁니다. } + } } + } else { + include_once(G5_LIB_PATH . '/icode.sms.lib.php'); + + // 답변글은 질문 등록자에게 전송 + if ($w == 'a' && $write['qa_sms_recv'] && trim($write['qa_hp'])) { + $sms_content = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . '에 답변이 등록되었습니다.'; + $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); + $recv_number = preg_replace('/[^0-9]/', '', $write['qa_hp']); + + if ($recv_number) { + $SMS = new SMS; // SMS 연결 + $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']); + $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), ""); + $SMS->Send(); + } + } + + // 문의글 등록시 관리자에게 전송 + if (($w == '' || $w == 'r') && trim($qaconfig['qa_admin_hp'])) { + $sms_content = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . '에 문의글이 등록되었습니다.'; + $send_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_send_number']); + $recv_number = preg_replace('/[^0-9]/', '', $qaconfig['qa_admin_hp']); + + if ($recv_number) { + $SMS = new SMS; // SMS 연결 + $SMS->SMS_con($config['cf_icode_server_ip'], $config['cf_icode_id'], $config['cf_icode_pw'], $config['cf_icode_server_port']); + $SMS->Add($recv_number, $send_number, $config['cf_icode_id'], iconv("utf-8", "euc-kr", stripslashes($sms_content)), ""); + $SMS->Send(); + } + } + } } // 답변 이메일전송 -if($w == 'a' && $write['qa_email_recv'] && trim($write['qa_email'])) { - include_once(G5_LIB_PATH.'/mailer.lib.php'); +if ($w == 'a' && $write['qa_email_recv'] && trim($write['qa_email'])) { + include_once(G5_LIB_PATH . '/mailer.lib.php'); - $subject = $config['cf_title'].' '.$qaconfig['qa_title'].' 답변 알림 메일'; - $content = nl2br(conv_unescape_nl(stripslashes($qa_content))); + $subject = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . ' 답변 알림 메일'; + $content = nl2br(conv_unescape_nl(stripslashes($qa_content))); - mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $write['qa_email'], $subject, $content, 1); + mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $write['qa_email'], $subject, $content, 1); } // 문의글등록 이메일전송 -if(($w == '' || $w == 'r') && trim($qaconfig['qa_admin_email'])) { - include_once(G5_LIB_PATH.'/mailer.lib.php'); +if (($w == '' || $w == 'r') && trim($qaconfig['qa_admin_email'])) { + include_once(G5_LIB_PATH . '/mailer.lib.php'); - $subject = $config['cf_title'].' '.$qaconfig['qa_title'].' 질문 알림 메일'; - $content = nl2br(conv_unescape_nl(stripslashes($qa_content))); + $subject = $config['cf_title'] . ' ' . $qaconfig['qa_title'] . ' 질문 알림 메일'; + $content = nl2br(conv_unescape_nl(stripslashes($qa_content))); - mailer($config['cf_admin_email_name'], $qa_email, $qaconfig['qa_admin_email'], $subject, $content, 1); + mailer($config['cf_admin_email_name'], $qa_email, $qaconfig['qa_admin_email'], $subject, $content, 1); } -if($w == 'a') - $result_url = G5_BBS_URL.'/qaview.php?qa_id='.$qa_id.$qstr; -else if($w == 'u' && $write['qa_type']) - $result_url = G5_BBS_URL.'/qaview.php?qa_id='.$write['qa_parent'].$qstr; +if ($w == 'a') + $result_url = G5_BBS_URL . '/qaview.php?qa_id=' . $qa_id . $qstr; +else if ($w == 'u' && $write['qa_type']) + $result_url = G5_BBS_URL . '/qaview.php?qa_id=' . $write['qa_parent'] . $qstr; else - $result_url = G5_BBS_URL.'/qalist.php'.preg_replace('/^&/', '?', $qstr); + $result_url = G5_BBS_URL . '/qalist.php' . preg_replace('/^&/', '?', $qstr); if ($file_upload_msg) - alert($file_upload_msg, $result_url); + alert($file_upload_msg, $result_url); else - goto_url($result_url); -?> \ No newline at end of file + goto_url($result_url); diff --git a/AvocadoEdition_Light/bbs/register.php b/AvocadoEdition_Light/bbs/register.php index 6b119f8..f326648 100644 --- a/AvocadoEdition_Light/bbs/register.php +++ b/AvocadoEdition_Light/bbs/register.php @@ -3,12 +3,12 @@ include_once('./_common.php'); // 로그인중인 경우 회원가입 할 수 없습니다. if ($is_member) { - goto_url(G5_URL); + goto_url(G5_URL); } -if(!$is_add_register) { - // 회원가입 기간 경과 - alert('계정생성 기간이 아닙니다.'); +if (!$is_add_register) { + // 회원가입 기간 경과 + alert('계정생성 기간이 아닙니다.'); } // 세션을 지웁니다. @@ -16,7 +16,7 @@ set_session("ss_mb_reg", ""); $g5['title'] = '회원가입약관'; -goto_url(G5_BBS_URL.'/register_form.php'); +goto_url(G5_BBS_URL . '/register_form.php'); //include_once('./_head.php'); @@ -24,4 +24,3 @@ goto_url(G5_BBS_URL.'/register_form.php'); //include_once($member_skin_path.'/register.skin.php'); //include_once('./_tail.php'); -?> diff --git a/AvocadoEdition_Light/bbs/register_email.php b/AvocadoEdition_Light/bbs/register_email.php index 2ff45ca..209ad6e 100644 --- a/AvocadoEdition_Light/bbs/register_email.php +++ b/AvocadoEdition_Light/bbs/register_email.php @@ -1,6 +1,6 @@

    메일인증을 받지 못한 경우 회원정보의 메일주소를 변경 할 수 있습니다.

    -
    - + + -
    +
    - - + + - - - + + + - +
    사이트 이용정보 입력
    사이트 이용정보 입력
    자동등록방지
    -
    +
    -
    + +
    '{$mb_id}' and mb_email = '$mb_email' "; $row = sql_fetch($sql); if ($row['cnt']) { - alert("{$mb_email} 메일은 이미 존재하는 메일주소 입니다.\\n\\n다른 메일주소를 입력해 주십시오."); + alert("{$mb_email} 메일은 이미 존재하는 메일주소 입니다.\\n\\n다른 메일주소를 입력해 주십시오."); } // 인증메일 발송 -$subject = '['.$config['cf_title'].'] 인증확인 메일입니다.'; +$subject = '[' . $config['cf_title'] . '] 인증확인 메일입니다.'; $mb_name = $mb['mb_name']; @@ -35,10 +35,10 @@ $mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand())); sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' "); -$certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&mb_md5='.$mb_md5; +$certify_href = G5_BBS_URL . '/email_certify.php?mb_id=' . $mb_id . '&mb_md5=' . $mb_md5; ob_start(); -include_once ('./register_form_update_mail3.php'); +include_once('./register_form_update_mail3.php'); $content = ob_get_contents(); ob_end_clean(); @@ -48,4 +48,3 @@ $sql = " update {$g5['member_table']} set mb_email = '$mb_email' where mb_id = ' sql_query($sql); alert("인증메일을 {$mb_email} 메일로 다시 보내 드렸습니다.\\n\\n잠시후 {$mb_email} 메일을 확인하여 주십시오.", G5_URL); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/register_form.php b/AvocadoEdition_Light/bbs/register_form.php index c5567b1..e00d6fb 100644 --- a/AvocadoEdition_Light/bbs/register_form.php +++ b/AvocadoEdition_Light/bbs/register_form.php @@ -1,143 +1,142 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/register_form_update.php b/AvocadoEdition_Light/bbs/register_form_update.php index 3ceb9b0..1d6ec35 100644 --- a/AvocadoEdition_Light/bbs/register_form_update.php +++ b/AvocadoEdition_Light/bbs/register_form_update.php @@ -1,154 +1,168 @@ date("Y-m-d", G5_SERVER_TIME - ($config['cf_nick_modify'] * 86400))) - $mb_nick = $member['mb_nick']; - // 회원정보의 메일을 이전 메일로 옮기고 아래에서 비교함 - $old_email = $member['mb_email']; + if (strtolower($mb_id) == strtolower($mb_recommend)) { + alert('본인을 추천할 수 없습니다.'); } + } else { + // 자바스크립트로 정보변경이 가능한 버그 수정 + // 닉네임수정일이 지나지 않았다면 + if ($member['mb_nick_date'] > date("Y-m-d", G5_SERVER_TIME - ($config['cf_nick_modify'] * 86400))) + $mb_nick = $member['mb_nick']; + // 회원정보의 메일을 이전 메일로 옮기고 아래에서 비교함 + $old_email = $member['mb_email']; + } - if ($msg = exist_mb_nick($mb_nick, $mb_id)) alert($msg, "", true, true); - if ($msg = exist_mb_email($mb_email, $mb_id)) alert($msg, "", true, true); + if ($msg = exist_mb_nick($mb_nick, $mb_id)) + alert($msg, "", true, true); + if ($msg = exist_mb_email($mb_email, $mb_id)) + alert($msg, "", true, true); } // 사용자 코드 실행 -@include_once($member_skin_path.'/register_form_update.head.skin.php'); +@include_once($member_skin_path . '/register_form_update.head.skin.php'); //=============================================================== // 본인확인 @@ -196,12 +210,12 @@ if ($config['cf_cert_use'] && $cert_type && $md5_cert_no) { //=============================================================== if ($w == '') { - $sql = " insert into {$g5['member_table']} + $sql = " insert into {$g5['member_table']} set mb_id = '{$mb_id}', - mb_password = '".get_encrypt_string($mb_password)."', + mb_password = '" . get_encrypt_string($mb_password) . "', mb_name = '{$mb_name}', mb_nick = '{$mb_nick}', - mb_nick_date = '".G5_TIME_YMD."', + mb_nick_date = '" . G5_TIME_YMD . "', mb_email = '{$mb_email}', mb_homepage = '{$mb_homepage}', mb_tel = '{$mb_tel}', @@ -213,8 +227,8 @@ if ($w == '') { mb_addr_jibeon = '{$mb_addr_jibeon}', mb_signature = '{$mb_signature}', mb_profile = '{$mb_profile}', - mb_today_login = '".G5_TIME_YMDHIS."', - mb_datetime = '".G5_TIME_YMDHIS."', + mb_today_login = '" . G5_TIME_YMDHIS . "', + mb_datetime = '" . G5_TIME_YMDHIS . "', mb_ip = '{$_SERVER['REMOTE_ADDR']}', mb_level = '{$config['cf_register_level']}', mb_recommend = '{$mb_recommend}', @@ -222,7 +236,7 @@ if ($w == '') { mb_mailling = '{$mb_mailling}', mb_sms = '{$mb_sms}', mb_open = '{$mb_open}', - mb_open_date = '".G5_TIME_YMD."', + mb_open_date = '" . G5_TIME_YMD . "', mb_birth = '{$mb_birth}', mb_1 = '{$mb_1}', mb_2 = '{$mb_2}', @@ -236,84 +250,84 @@ if ($w == '') { mb_10 = '{$mb_10}' {$sql_certify} "; - // 이메일 인증을 사용하지 않는다면 이메일 인증시간을 바로 넣는다 - if (!$config['cf_use_email_certify']) - $sql .= " , mb_email_certify = '".G5_TIME_YMDHIS."' "; - sql_query($sql); + // 이메일 인증을 사용하지 않는다면 이메일 인증시간을 바로 넣는다 + if (!$config['cf_use_email_certify']) + $sql .= " , mb_email_certify = '" . G5_TIME_YMDHIS . "' "; + sql_query($sql); - // 회원가입 포인트 부여 - insert_point($mb_id, $config['cf_register_point'], '회원가입 축하', '@member', $mb_id, '회원가입'); + // 회원가입 포인트 부여 + insert_point($mb_id, $config['cf_register_point'], '회원가입 축하', '@member', $mb_id, '회원가입'); - // 추천인에게 포인트 부여 - if ($config['cf_use_recommend'] && $mb_recommend) - insert_point($mb_recommend, $config['cf_recommend_point'], $mb_id.'의 추천인', '@member', $mb_recommend, $mb_id.' 추천'); + // 추천인에게 포인트 부여 + if ($config['cf_use_recommend'] && $mb_recommend) + insert_point($mb_recommend, $config['cf_recommend_point'], $mb_id . '의 추천인', '@member', $mb_recommend, $mb_id . ' 추천'); - // 회원님께 메일 발송 - if ($config['cf_email_mb_member']) { - $subject = '['.$config['cf_title'].'] 회원가입을 축하드립니다.'; + // 회원님께 메일 발송 + if ($config['cf_email_mb_member']) { + $subject = '[' . $config['cf_title'] . '] 회원가입을 축하드립니다.'; - // 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용 - if ($config['cf_use_email_certify']) { - $mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand())); - sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' "); - $certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&mb_md5='.$mb_md5; - } - - ob_start(); - include_once ('./register_form_update_mail1.php'); - $content = ob_get_contents(); - ob_end_clean(); - - mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1); - - // 메일인증을 사용하는 경우 가입메일에 인증 url이 있으므로 인증메일을 다시 발송되지 않도록 함 - if($config['cf_use_email_certify']) - $old_email = $mb_email; + // 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용 + if ($config['cf_use_email_certify']) { + $mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand())); + sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' "); + $certify_href = G5_BBS_URL . '/email_certify.php?mb_id=' . $mb_id . '&mb_md5=' . $mb_md5; } - // 최고관리자님께 메일 발송 - if ($config['cf_email_mb_super_admin']) { - $subject = '['.$config['cf_title'].'] '.$mb_nick .' 님께서 회원으로 가입하셨습니다.'; + ob_start(); + include_once('./register_form_update_mail1.php'); + $content = ob_get_contents(); + ob_end_clean(); - ob_start(); - include_once ('./register_form_update_mail2.php'); - $content = ob_get_contents(); - ob_end_clean(); + mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1); - mailer($mb_nick, $mb_email, $config['cf_admin_email'], $subject, $content, 1); - } + // 메일인증을 사용하는 경우 가입메일에 인증 url이 있으므로 인증메일을 다시 발송되지 않도록 함 + if ($config['cf_use_email_certify']) + $old_email = $mb_email; + } - // 메일인증 사용하지 않는 경우에만 로그인 - if (!$config['cf_use_email_certify']) - set_session('ss_mb_id', $mb_id); + // 최고관리자님께 메일 발송 + if ($config['cf_email_mb_super_admin']) { + $subject = '[' . $config['cf_title'] . '] ' . $mb_nick . ' 님께서 회원으로 가입하셨습니다.'; - set_session('ss_mb_reg', $mb_id); + ob_start(); + include_once('./register_form_update_mail2.php'); + $content = ob_get_contents(); + ob_end_clean(); + + mailer($mb_nick, $mb_email, $config['cf_admin_email'], $subject, $content, 1); + } + + // 메일인증 사용하지 않는 경우에만 로그인 + if (!$config['cf_use_email_certify']) + set_session('ss_mb_id', $mb_id); + + set_session('ss_mb_reg', $mb_id); } else if ($w == 'u') { - if (!trim($_SESSION['ss_mb_id'])) - alert('로그인 되어 있지 않습니다.'); + if (!trim($_SESSION['ss_mb_id'])) + alert('로그인 되어 있지 않습니다.'); - if (trim($_POST['mb_id']) != $mb_id) - alert("로그인된 정보와 수정하려는 정보가 틀리므로 수정할 수 없습니다.\\n만약 올바르지 않은 방법을 사용하신다면 바로 중지하여 주십시오."); + if (trim($_POST['mb_id']) != $mb_id) + alert("로그인된 정보와 수정하려는 정보가 틀리므로 수정할 수 없습니다.\\n만약 올바르지 않은 방법을 사용하신다면 바로 중지하여 주십시오."); - $sql_password = ""; - if ($mb_password) - $sql_password = " , mb_password = '".get_encrypt_string($mb_password)."' "; + $sql_password = ""; + if ($mb_password) + $sql_password = " , mb_password = '" . get_encrypt_string($mb_password) . "' "; - $sql_nick_date = ""; - if ($mb_nick_default != $mb_nick) - $sql_nick_date = " , mb_nick_date = '".G5_TIME_YMD."' "; + $sql_nick_date = ""; + if ($mb_nick_default != $mb_nick) + $sql_nick_date = " , mb_nick_date = '" . G5_TIME_YMD . "' "; - $sql_open_date = ""; - if ($mb_open_default != $mb_open) - $sql_open_date = " , mb_open_date = '".G5_TIME_YMD."' "; + $sql_open_date = ""; + if ($mb_open_default != $mb_open) + $sql_open_date = " , mb_open_date = '" . G5_TIME_YMD . "' "; - // 이전 메일주소와 수정한 메일주소가 틀리다면 인증을 다시 해야하므로 값을 삭제 - $sql_email_certify = ''; - if ($old_email != $mb_email && $config['cf_use_email_certify']) - $sql_email_certify = " , mb_email_certify = '' "; + // 이전 메일주소와 수정한 메일주소가 틀리다면 인증을 다시 해야하므로 값을 삭제 + $sql_email_certify = ''; + if ($old_email != $mb_email && $config['cf_use_email_certify']) + $sql_email_certify = " , mb_email_certify = '' "; - $sql = " update {$g5['member_table']} + $sql = " update {$g5['member_table']} set mb_name = '{$mb_name}', mb_nick = '{$mb_nick}', mb_mailling = '{$mb_mailling}', @@ -347,16 +361,16 @@ if ($w == '') { {$sql_email_certify} {$sql_certify} where mb_id = '$mb_id' "; - sql_query($sql); + sql_query($sql); } // 회원 아이콘 -$mb_dir = G5_DATA_PATH.'/member/'.substr($mb_id,0,2); +$mb_dir = G5_DATA_PATH . '/member/' . substr($mb_id, 0, 2); // 아이콘 삭제 if (isset($_POST['del_mb_icon'])) { - @unlink($mb_dir.'/'.$mb_id.'.gif'); + @unlink($mb_dir . '/' . $mb_id . '.gif'); } $msg = ""; @@ -364,61 +378,61 @@ $msg = ""; // 아이콘 업로드 $mb_icon = ''; if (isset($_FILES['mb_icon']) && is_uploaded_file($_FILES['mb_icon']['tmp_name'])) { - if (preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) { - // 아이콘 용량이 설정값보다 이하만 업로드 가능 - if ($_FILES['mb_icon']['size'] <= $config['cf_member_icon_size']) { - @mkdir($mb_dir, G5_DIR_PERMISSION); - @chmod($mb_dir, G5_DIR_PERMISSION); - $dest_path = $mb_dir.'/'.$mb_id.'.gif'; - move_uploaded_file($_FILES['mb_icon']['tmp_name'], $dest_path); - chmod($dest_path, G5_FILE_PERMISSION); - if (file_exists($dest_path)) { - //=================================================================\ - // 090714 - // gif 파일에 악성코드를 심어 업로드 하는 경우를 방지 - // 에러메세지는 출력하지 않는다. - //----------------------------------------------------------------- - $size = getimagesize($dest_path); - if ($size[2] != 1) // gif 파일이 아니면 올라간 이미지를 삭제한다. - @unlink($dest_path); - else - // 아이콘의 폭 또는 높이가 설정값 보다 크다면 이미 업로드 된 아이콘 삭제 - if ($size[0] > $config['cf_member_icon_width'] || $size[1] > $config['cf_member_icon_height']) - @unlink($dest_path); - //=================================================================\ - } - } else { - $msg .= '회원아이콘을 '.number_format($config['cf_member_icon_size']).'바이트 이하로 업로드 해주십시오.'; - } - + if (preg_match("/(\.gif)$/i", $_FILES['mb_icon']['name'])) { + // 아이콘 용량이 설정값보다 이하만 업로드 가능 + if ($_FILES['mb_icon']['size'] <= $config['cf_member_icon_size']) { + @mkdir($mb_dir, G5_DIR_PERMISSION); + @chmod($mb_dir, G5_DIR_PERMISSION); + $dest_path = $mb_dir . '/' . $mb_id . '.gif'; + move_uploaded_file($_FILES['mb_icon']['tmp_name'], $dest_path); + chmod($dest_path, G5_FILE_PERMISSION); + if (file_exists($dest_path)) { + //=================================================================\ + // 090714 + // gif 파일에 악성코드를 심어 업로드 하는 경우를 방지 + // 에러메세지는 출력하지 않는다. + //----------------------------------------------------------------- + $size = getimagesize($dest_path); + if ($size[2] != 1) // gif 파일이 아니면 올라간 이미지를 삭제한다. + @unlink($dest_path); + else + // 아이콘의 폭 또는 높이가 설정값 보다 크다면 이미 업로드 된 아이콘 삭제 + if ($size[0] > $config['cf_member_icon_width'] || $size[1] > $config['cf_member_icon_height']) + @unlink($dest_path); + //=================================================================\ + } } else { - $msg .= $_FILES['mb_icon']['name'].'은(는) gif 파일이 아닙니다.'; + $msg .= '회원아이콘을 ' . number_format($config['cf_member_icon_size']) . '바이트 이하로 업로드 해주십시오.'; } + + } else { + $msg .= $_FILES['mb_icon']['name'] . '은(는) gif 파일이 아닙니다.'; + } } // 인증메일 발송 if ($config['cf_use_email_certify'] && $old_email != $mb_email) { - $subject = '['.$config['cf_title'].'] 인증확인 메일입니다.'; + $subject = '[' . $config['cf_title'] . '] 인증확인 메일입니다.'; - // 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용 - $mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand())); + // 어떠한 회원정보도 포함되지 않은 일회용 난수를 생성하여 인증에 사용 + $mb_md5 = md5(pack('V*', rand(), rand(), rand(), rand())); - sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' "); + sql_query(" update {$g5['member_table']} set mb_email_certify2 = '$mb_md5' where mb_id = '$mb_id' "); - $certify_href = G5_BBS_URL.'/email_certify.php?mb_id='.$mb_id.'&mb_md5='.$mb_md5; + $certify_href = G5_BBS_URL . '/email_certify.php?mb_id=' . $mb_id . '&mb_md5=' . $mb_md5; - ob_start(); - include_once ('./register_form_update_mail3.php'); - $content = ob_get_contents(); - ob_end_clean(); + ob_start(); + include_once('./register_form_update_mail3.php'); + $content = ob_get_contents(); + ob_end_clean(); - mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1); + mailer($config['cf_admin_email_name'], $config['cf_admin_email'], $mb_email, $subject, $content, 1); } // 사용자 코드 실행 -@include_once ($member_skin_path.'/register_form_update.tail.skin.php'); +@include_once($member_skin_path . '/register_form_update.tail.skin.php'); unset($_SESSION['ss_cert_type']); unset($_SESSION['ss_cert_no']); @@ -427,29 +441,29 @@ unset($_SESSION['ss_cert_birth']); unset($_SESSION['ss_cert_adult']); if ($msg) - echo ''; + echo ''; if ($w == '') { - goto_url(G5_HTTP_BBS_URL.'/register_result.php'); + goto_url(G5_HTTP_BBS_URL . '/register_result.php'); } else if ($w == 'u') { - $row = sql_fetch(" select mb_password from {$g5['member_table']} where mb_id = '{$member['mb_id']}' "); - $tmp_password = $row['mb_password']; + $row = sql_fetch(" select mb_password from {$g5['member_table']} where mb_id = '{$member['mb_id']}' "); + $tmp_password = $row['mb_password']; - if ($old_email != $mb_email && $config['cf_use_email_certify']) { - set_session('ss_mb_id', ''); - alert('회원 정보가 수정 되었습니다.\n\nE-mail 주소가 변경되었으므로 다시 인증하셔야 합니다.', G5_URL); - } else { - echo ' + if ($old_email != $mb_email && $config['cf_use_email_certify']) { + set_session('ss_mb_id', ''); + alert('회원 정보가 수정 되었습니다.\n\nE-mail 주소가 변경되었으므로 다시 인증하셔야 합니다.', G5_URL); + } else { + echo ' 회원정보수정 -
    + - - + +
    '; - } + } } -?> diff --git a/AvocadoEdition_Light/bbs/register_form_update_mail1.php b/AvocadoEdition_Light/bbs/register_form_update_mail1.php index e2ec67c..1f090b5 100644 --- a/AvocadoEdition_Light/bbs/register_form_update_mail1.php +++ b/AvocadoEdition_Light/bbs/register_form_update_mail1.php @@ -1,39 +1,45 @@ + - -회원가입 축하 메일 + + 회원가입 축하 메일 -
    +
    -

    - 회원가입을 축하합니다. -

    - - - -

    - 님의 회원가입을 진심으로 축하합니다.
    - 회원님의 성원에 보답하고자 더욱 더 열심히 하겠습니다.
    - 아래의 메일인증을 클릭하시면 회원가입이 완료됩니다.
    - 감사합니다. -

    +

    + 회원가입을 축하합니다. +

    + + + +

    + 님의 회원가입을 진심으로 축하합니다.
    + 회원님의 성원에 보답하고자 더욱 더 열심히 하겠습니다.
    + 아래의 메일인증을 클릭하시면 회원가입이 완료됩니다.
    + 감사합니다. +

    - - 메일인증 - - 사이트바로가기 - + + 메일인증 + + 사이트바로가기 +
    -
    +
    + diff --git a/AvocadoEdition_Light/bbs/register_form_update_mail2.php b/AvocadoEdition_Light/bbs/register_form_update_mail2.php index f30b7b9..59ce556 100644 --- a/AvocadoEdition_Light/bbs/register_form_update_mail2.php +++ b/AvocadoEdition_Light/bbs/register_form_update_mail2.php @@ -1,35 +1,41 @@ + - -회원가입 알림 메일 + + 회원가입 알림 메일 -
    +
    -

    - 회원가입 알림 메일 -

    - - - -

    - 님께서 회원가입 하셨습니다.
    - 회원 아이디 :
    - 회원 이름 :
    - 회원 닉네임 :
    - 추천인아이디 : -

    - 관리자에서 회원정보 확인하기 +

    + 회원가입 알림 메일 +

    + + + +

    + 님께서 회원가입 하셨습니다.
    + 회원 아이디 :
    + 회원 이름 :
    + 회원 닉네임 :
    + 추천인아이디 : +

    + 관리자에서 + 회원정보 확인하기
    -
    +
    + diff --git a/AvocadoEdition_Light/bbs/register_form_update_mail3.php b/AvocadoEdition_Light/bbs/register_form_update_mail3.php index 5ae4d46..b7c1e3d 100644 --- a/AvocadoEdition_Light/bbs/register_form_update_mail3.php +++ b/AvocadoEdition_Light/bbs/register_form_update_mail3.php @@ -1,39 +1,45 @@ + - -회원 인증 메일 + + 회원 인증 메일 -
    +
    -

    - 회원 인증 메일입니다. -

    - - - -

    - - 님의 E-mail 주소가 변경되었습니다.

    - +

    + 회원 인증 메일입니다. +

    + + + +

    + + 님의 E-mail 주소가 변경되었습니다.

    + - 아래의 주소를 클릭하시면 인증이 완료됩니다.
    -

    + 아래의 주소를 클릭하시면 인증이 완료됩니다.
    +

    - 회원님의 성원에 보답하고자 더욱 더 열심히 하겠습니다.
    - 감사합니다. -

    - 로그인 + 회원님의 성원에 보답하고자 더욱 더 열심히 하겠습니다.
    + 감사합니다. +

    + + 로그인
    -
    +
    + diff --git a/AvocadoEdition_Light/bbs/register_result.php b/AvocadoEdition_Light/bbs/register_result.php index 831c986..11f1e98 100644 --- a/AvocadoEdition_Light/bbs/register_result.php +++ b/AvocadoEdition_Light/bbs/register_result.php @@ -2,14 +2,13 @@ include_once('./_common.php'); if (isset($_SESSION['ss_mb_reg'])) - $mb = get_member($_SESSION['ss_mb_reg']); + $mb = get_member($_SESSION['ss_mb_reg']); // 회원정보가 없다면 초기 페이지로 이동 if (!$mb['mb_id']) - goto_url(G5_URL); + goto_url(G5_URL); $g5['title'] = '회원가입이 완료되었습니다.'; include_once('./_head.php'); -include_once($member_skin_path.'/register_result.skin.php'); +include_once($member_skin_path . '/register_result.skin.php'); include_once('./_tail.php'); -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/rss.php b/AvocadoEdition_Light/bbs/rss.php index 04c9428..b9b5742 100644 --- a/AvocadoEdition_Light/bbs/rss.php +++ b/AvocadoEdition_Light/bbs/rss.php @@ -2,20 +2,21 @@ include_once('./_common.php'); // 특수문자 변환 -function specialchars_replace($str, $len=0) { - if ($len) { - $str = substr($str, 0, $len); - } +function specialchars_replace($str, $len = 0) +{ + if ($len) { + $str = substr($str, 0, $len); + } - $str = str_replace(array("&", "<", ">"), array("&", "<", ">"), $str); + $str = str_replace(array("&", "<", ">"), array("&", "<", ">"), $str); - /* - $str = preg_replace("/&/", "&", $str); - $str = preg_replace("//", ">", $str); - */ + /* + $str = preg_replace("/&/", "&", $str); + $str = preg_replace("//", ">", $str); + */ - return $str; + return $str; } $sql = " select gr_id, bo_subject, bo_page_rows, bo_read_level, bo_use_rss_view from {$g5['board_table']} where bo_table = '$bo_table' "; @@ -25,14 +26,14 @@ $lines = $row['bo_page_rows']; // 비회원 읽기가 가능한 게시판만 RSS 지원 if ($row['bo_read_level'] >= 2) { - echo '비회원 읽기가 가능한 게시판만 RSS 지원합니다.'; - exit; + echo '비회원 읽기가 가능한 게시판만 RSS 지원합니다.'; + exit; } // RSS 사용 체크 if (!$row['bo_use_rss_view']) { - echo 'RSS 보기가 금지되어 있습니다.'; - exit; + echo 'RSS 보기가 금지되어 있습니다.'; + exit; } header('Content-type: text/xml'); @@ -43,48 +44,49 @@ $sql = " select gr_subject from {$g5['group_table']} where gr_id = '{$row['gr_id $row = sql_fetch($sql); $subj1 = specialchars_replace($row['gr_subject'], 255); -echo ''."\n"; +echo '' . "\n"; ?> - -<?php echo specialchars_replace($config['cf_title'].' > '.$subj1.' > '.$subj2) ?> - -테스트 버전 0.2 (2004-04-26) -ko + + <?php echo specialchars_replace($config['cf_title'] . ' > ' . $subj1 . ' > ' . $subj2) ?> + + 테스트 버전 0.2 (2004-04-26) + ko - + ?> - -<?php echo specialchars_replace($row['wr_subject']) ?> - -]]> - - + <?php echo specialchars_replace($row['wr_subject']) ?> + + + ]]> + + - - + $date = date('r', strtotime($date)); + ?> + + -'."\n"; -echo ''."\n"; -?> + echo '' . "\n"; + echo '' . "\n"; + ?> diff --git a/AvocadoEdition_Light/bbs/scrap.php b/AvocadoEdition_Light/bbs/scrap.php index 61ced3e..2ddfe0f 100644 --- a/AvocadoEdition_Light/bbs/scrap.php +++ b/AvocadoEdition_Light/bbs/scrap.php @@ -2,10 +2,10 @@ include_once('./_common.php'); if (!$is_member) - alert_close('회원만 조회하실 수 있습니다.'); + alert_close('회원만 조회하실 수 있습니다.'); -$g5['title'] = get_text($member['mb_nick']).'님의 스크랩'; -include_once(G5_PATH.'/head.sub.php'); +$g5['title'] = get_text($member['mb_nick']) . '님의 스크랩'; +include_once(G5_PATH . '/head.sub.php'); $sql_common = " from {$g5['scrap_table']} where mb_id = '{$member['mb_id']}' "; $sql_order = " order by ms_id desc "; @@ -15,8 +15,9 @@ $row = sql_fetch($sql); $total_count = $row['cnt']; $rows = $config['cf_page_rows']; -$total_page = ceil($total_count / $rows); // 전체 페이지 계산 -if ($page < 1) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) +$total_page = ceil($total_count / $rows); // 전체 페이지 계산 +if ($page < 1) + $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ($page - 1) * $rows; // 시작 열을 구함 $list = array(); @@ -26,35 +27,35 @@ $sql = " select * $sql_order limit $from_record, $rows "; $result = sql_query($sql); -for ($i=0; $row=sql_fetch_array($result); $i++) { +for ($i = 0; $row = sql_fetch_array($result); $i++) { - $list[$i] = $row; + $list[$i] = $row; - // 순차적인 번호 (순번) - $num = $total_count - ($page - 1) * $rows - $i; + // 순차적인 번호 (순번) + $num = $total_count - ($page - 1) * $rows - $i; - // 게시판 제목 - $sql2 = " select bo_subject from {$g5['board_table']} where bo_table = '{$row['bo_table']}' "; - $row2 = sql_fetch($sql2); - if (!$row2['bo_subject']) $row2['bo_subject'] = '[게시판 없음]'; + // 게시판 제목 + $sql2 = " select bo_subject from {$g5['board_table']} where bo_table = '{$row['bo_table']}' "; + $row2 = sql_fetch($sql2); + if (!$row2['bo_subject']) + $row2['bo_subject'] = '[게시판 없음]'; - // 게시물 제목 - $tmp_write_table = $g5['write_prefix'] . $row['bo_table']; - $sql3 = " select wr_subject from $tmp_write_table where wr_id = '{$row['wr_id']}' "; - $row3 = sql_fetch($sql3, FALSE); - $subject = get_text(cut_str($row3['wr_subject'], 100)); - if (!$row3['wr_subject']) - $row3['wr_subject'] = '[글 없음]'; + // 게시물 제목 + $tmp_write_table = $g5['write_prefix'] . $row['bo_table']; + $sql3 = " select wr_subject from $tmp_write_table where wr_id = '{$row['wr_id']}' "; + $row3 = sql_fetch($sql3, FALSE); + $subject = get_text(cut_str($row3['wr_subject'], 100)); + if (!$row3['wr_subject']) + $row3['wr_subject'] = '[글 없음]'; - $list[$i]['num'] = $num; - $list[$i]['opener_href'] = './board.php?bo_table='.$row['bo_table']; - $list[$i]['opener_href_wr_id'] = './board.php?bo_table='.$row['bo_table'].'&wr_id='.$row['wr_id']; - $list[$i]['bo_subject'] = $row2['bo_subject']; - $list[$i]['subject'] = $subject; - $list[$i]['del_href'] = './scrap_delete.php?ms_id='.$row['ms_id'].'&page='.$page; + $list[$i]['num'] = $num; + $list[$i]['opener_href'] = './board.php?bo_table=' . $row['bo_table']; + $list[$i]['opener_href_wr_id'] = './board.php?bo_table=' . $row['bo_table'] . '&wr_id=' . $row['wr_id']; + $list[$i]['bo_subject'] = $row2['bo_subject']; + $list[$i]['subject'] = $subject; + $list[$i]['del_href'] = './scrap_delete.php?ms_id=' . $row['ms_id'] . '&page=' . $page; } -include_once($member_skin_path.'/scrap.skin.php'); +include_once($member_skin_path . '/scrap.skin.php'); +include_once(G5_PATH . '/tail.sub.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> diff --git a/AvocadoEdition_Light/bbs/scrap_delete.php b/AvocadoEdition_Light/bbs/scrap_delete.php index 6d61659..c21e31b 100644 --- a/AvocadoEdition_Light/bbs/scrap_delete.php +++ b/AvocadoEdition_Light/bbs/scrap_delete.php @@ -2,10 +2,9 @@ include_once('./_common.php'); if (!$is_member) - alert('회원만 이용하실 수 있습니다.'); + alert('회원만 이용하실 수 있습니다.'); $sql = " delete from {$g5['scrap_table']} where mb_id = '{$member['mb_id']}' and ms_id = '$ms_id' "; sql_query($sql); -goto_url('./scrap.php?page='.$page); -?> +goto_url('./scrap.php?page=' . $page); diff --git a/AvocadoEdition_Light/bbs/scrap_popin.php b/AvocadoEdition_Light/bbs/scrap_popin.php index 8bb8186..5e9bb71 100644 --- a/AvocadoEdition_Light/bbs/scrap_popin.php +++ b/AvocadoEdition_Light/bbs/scrap_popin.php @@ -1,12 +1,12 @@ alert('회원만 접근 가능합니다.'); opener.location.href = '$href2'; @@ -17,7 +17,7 @@ if ($is_guest) { 로그인하기 HEREDOC; - exit; + exit; } echo << if (confirm('이미 스크랩하신 글 입니다.\\n\\n지금 스크랩을 확인하시겠습니까?')) document.location.href = './scrap.php'; @@ -51,10 +51,9 @@ if ($row['cnt']) { 돌아가기 HEREDOC; - exit; + exit; } -include_once($member_skin_path.'/scrap_popin.skin.php'); +include_once($member_skin_path . '/scrap_popin.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/scrap_popin_update.php b/AvocadoEdition_Light/bbs/scrap_popin_update.php index 5c94f90..afe3f14 100644 --- a/AvocadoEdition_Light/bbs/scrap_popin_update.php +++ b/AvocadoEdition_Light/bbs/scrap_popin_update.php @@ -1,29 +1,27 @@ alert(\'회원만 접근 가능합니다.\'); top.location.href = \''.str_replace('&', '&', $href).'\'; '; - exit; +if (!$is_member) { + $href = './login.php?' . $qstr . '&url=' . urlencode('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id); + echo ''; + exit; } // 게시글 존재하는지 -if(!$write['wr_id']) - alert_close('스크랩하시려는 게시글이 존재하지 않습니다.'); +if (!$write['wr_id']) + alert_close('스크랩하시려는 게시글이 존재하지 않습니다.'); $sql = " select count(*) as cnt from {$g5['scrap_table']} where mb_id = '{$member['mb_id']}' and bo_table = '$bo_table' and wr_id = '$wr_id' "; $row = sql_fetch($sql); -if ($row['cnt']) -{ - echo ' +if ($row['cnt']) { + echo ' '."\n"; + echo '' . "\n"; -@include_once($board_skin_path.'/view_comment.tail.skin.php'); -?> \ No newline at end of file +@include_once($board_skin_path . '/view_comment.tail.skin.php'); diff --git a/AvocadoEdition_Light/bbs/view_image.php b/AvocadoEdition_Light/bbs/view_image.php index 779f83a..79133d2 100644 --- a/AvocadoEdition_Light/bbs/view_image.php +++ b/AvocadoEdition_Light/bbs/view_image.php @@ -2,109 +2,109 @@ include_once('./_common.php'); $g5['title'] = '이미지 크게보기'; -include_once(G5_PATH.'/head.sub.php'); +include_once(G5_PATH . '/head.sub.php'); $filename = $_GET['fn']; $bo_table = $_GET['bo_table']; -if(strpos($filename, 'data/editor')) { - $editor_file = strstr($filename, 'editor'); - $filepath = G5_DATA_PATH.'/'.$editor_file; -} else if(strpos($filename, 'data/qa')) { - $editor_file = strstr($filename, 'qa'); - $filepath = G5_DATA_PATH.'/'.$editor_file; +if (strpos($filename, 'data/editor')) { + $editor_file = strstr($filename, 'editor'); + $filepath = G5_DATA_PATH . '/' . $editor_file; +} else if (strpos($filename, 'data/qa')) { + $editor_file = strstr($filename, 'qa'); + $filepath = G5_DATA_PATH . '/' . $editor_file; } else { - $editor_file = ''; - $filepath = G5_DATA_PATH.'/file/'.$bo_table.'/'.$filename; + $editor_file = ''; + $filepath = G5_DATA_PATH . '/file/' . $bo_table . '/' . $filename; } -if(is_file($filepath)) { - $size = @getimagesize($filepath); - if(empty($size)) - alert_close('이미지 파일이 아닙니다.'); +if (is_file($filepath)) { + $size = @getimagesize($filepath); + if (empty($size)) + alert_close('이미지 파일이 아닙니다.'); - $width = $size[0]; - $height = $size[1]; + $width = $size[0]; + $height = $size[1]; - if($editor_file) - $fileurl = G5_DATA_URL.'/'.$editor_file; - else - $fileurl = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename; + if ($editor_file) + $fileurl = G5_DATA_URL . '/' . $editor_file; + else + $fileurl = G5_DATA_URL . '/file/' . $bo_table . '/' . $filename; - $img = ''; + $img = ''; } else { - alert_close('파일이 존재하지 않습니다.'); + alert_close('파일이 존재하지 않습니다.'); } ?>
    \ No newline at end of file +include_once(G5_PATH . '/tail.sub.php'); +?> diff --git a/AvocadoEdition_Light/bbs/visit_browscap.inc.php b/AvocadoEdition_Light/bbs/visit_browscap.inc.php index 7bfd0db..306dd6e 100644 --- a/AvocadoEdition_Light/bbs/visit_browscap.inc.php +++ b/AvocadoEdition_Light/bbs/visit_browscap.inc.php @@ -1,21 +1,21 @@ =') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) - return; +if (!(version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE)) + return; // Browscap 캐시 파일이 있으면 실행 -if(defined('G5_VISIT_BROWSCAP_USE') && G5_VISIT_BROWSCAP_USE && is_file(G5_DATA_PATH.'/cache/browscap_cache.php')) { - include_once(G5_PLUGIN_PATH.'/browscap/Browscap.php'); +if (defined('G5_VISIT_BROWSCAP_USE') && G5_VISIT_BROWSCAP_USE && is_file(G5_DATA_PATH . '/cache/browscap_cache.php')) { + include_once(G5_PLUGIN_PATH . '/browscap/Browscap.php'); - $browscap = new phpbrowscap\Browscap(G5_DATA_PATH.'/cache'); - $browscap->doAutoUpdate = false; - $browscap->cacheFilename = 'browscap_cache.php'; + $browscap = new phpbrowscap\Browscap(G5_DATA_PATH . '/cache'); + $browscap->doAutoUpdate = false; + $browscap->cacheFilename = 'browscap_cache.php'; - $info = $browscap->getBrowser($_SERVER['HTTP_USER_AGENT']); + $info = $browscap->getBrowser($_SERVER['HTTP_USER_AGENT']); - $vi_browser = $info->Comment; - $vi_os = $info->Platform; - $vi_device = $info->Device_Type; + $vi_browser = $info->Comment; + $vi_os = $info->Platform; + $vi_device = $info->Device_Type; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/visit_insert.inc.php b/AvocadoEdition_Light/bbs/visit_insert.inc.php index 50a9bc7..edbf06e 100644 --- a/AvocadoEdition_Light/bbs/visit_insert.inc.php +++ b/AvocadoEdition_Light/bbs/visit_insert.inc.php @@ -1,69 +1,68 @@ =') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE) { - include_once(G5_BBS_PATH.'/visit_browscap.inc.php'); - } - $sql = " insert {$g5['visit_table']} ( vi_id, vi_ip, vi_date, vi_time, vi_referer, vi_agent, vi_browser, vi_os, vi_device ) values ( '{$vi_id}', '{$remote_addr}', '".G5_TIME_YMD."', '".G5_TIME_HIS."', '{$referer}', '{$user_agent}', '{$vi_browser}', '{$vi_os}', '{$vi_device}' ) "; + // $_SERVER 배열변수 값의 변조를 이용한 SQL Injection 공격을 막는 코드입니다. 110810 + $remote_addr = escape_trim($_SERVER['REMOTE_ADDR']); + $referer = ""; + if (isset($_SERVER['HTTP_REFERER'])) + $referer = escape_trim(clean_xss_tags($_SERVER['HTTP_REFERER'])); + $user_agent = escape_trim(clean_xss_tags($_SERVER['HTTP_USER_AGENT'])); + $vi_browser = ''; + $vi_os = ''; + $vi_device = ''; + if (version_compare(phpversion(), '5.3.0', '>=') && defined('G5_BROWSCAP_USE') && G5_BROWSCAP_USE) { + include_once(G5_BBS_PATH . '/visit_browscap.inc.php'); + } + $sql = " insert {$g5['visit_table']} ( vi_id, vi_ip, vi_date, vi_time, vi_referer, vi_agent, vi_browser, vi_os, vi_device ) values ( '{$vi_id}', '{$remote_addr}', '" . G5_TIME_YMD . "', '" . G5_TIME_HIS . "', '{$referer}', '{$user_agent}', '{$vi_browser}', '{$vi_os}', '{$vi_device}' ) "; + $result = sql_query($sql, FALSE); + // 정상으로 INSERT 되었다면 방문자 합계에 반영 + if ($result) { + $sql = " insert {$g5['visit_sum_table']} ( vs_count, vs_date) values ( 1, '" . G5_TIME_YMD . "' ) "; $result = sql_query($sql, FALSE); - // 정상으로 INSERT 되었다면 방문자 합계에 반영 - if ($result) { - $sql = " insert {$g5['visit_sum_table']} ( vs_count, vs_date) values ( 1, '".G5_TIME_YMD."' ) "; - $result = sql_query($sql, FALSE); - // DUPLICATE 오류가 발생한다면 이미 날짜별 행이 생성되었으므로 UPDATE 실행 - if (!$result) { - $sql = " update {$g5['visit_sum_table']} set vs_count = vs_count + 1 where vs_date = '".G5_TIME_YMD."' "; - $result = sql_query($sql); - } - - // INSERT, UPDATE 된건이 있다면 기본환경설정 테이블에 저장 - // 방문객 접속시마다 따로 쿼리를 하지 않기 위함 (엄청난 쿼리를 줄임 ^^) - - // 오늘 - $sql = " select vs_count as cnt from {$g5['visit_sum_table']} where vs_date = '".G5_TIME_YMD."' "; - $row = sql_fetch($sql); - $vi_today = $row['cnt']; - - // 어제 - $sql = " select vs_count as cnt from {$g5['visit_sum_table']} where vs_date = DATE_SUB('".G5_TIME_YMD."', INTERVAL 1 DAY) "; - $row = sql_fetch($sql); - $vi_yesterday = $row['cnt']; - - // 최대 - $sql = " select max(vs_count) as cnt from {$g5['visit_sum_table']} "; - $row = sql_fetch($sql); - $vi_max = $row['cnt']; - - // 전체 - $sql = " select sum(vs_count) as total from {$g5['visit_sum_table']} "; - $row = sql_fetch($sql); - $vi_sum = $row['total']; - - $visit = '오늘:'.$vi_today.',어제:'.$vi_yesterday.',최대:'.$vi_max.',전체:'.$vi_sum; - - // 기본설정 테이블에 방문자수를 기록한 후 - // 방문자수 테이블을 읽지 않고 출력한다. - // 쿼리의 수를 상당부분 줄임 - sql_query(" update {$g5['config_table']} set cf_visit = '{$visit}' "); + // DUPLICATE 오류가 발생한다면 이미 날짜별 행이 생성되었으므로 UPDATE 실행 + if (!$result) { + $sql = " update {$g5['visit_sum_table']} set vs_count = vs_count + 1 where vs_date = '" . G5_TIME_YMD . "' "; + $result = sql_query($sql); } + + // INSERT, UPDATE 된건이 있다면 기본환경설정 테이블에 저장 + // 방문객 접속시마다 따로 쿼리를 하지 않기 위함 (엄청난 쿼리를 줄임 ^^) + + // 오늘 + $sql = " select vs_count as cnt from {$g5['visit_sum_table']} where vs_date = '" . G5_TIME_YMD . "' "; + $row = sql_fetch($sql); + $vi_today = $row['cnt']; + + // 어제 + $sql = " select vs_count as cnt from {$g5['visit_sum_table']} where vs_date = DATE_SUB('" . G5_TIME_YMD . "', INTERVAL 1 DAY) "; + $row = sql_fetch($sql); + $vi_yesterday = $row['cnt']; + + // 최대 + $sql = " select max(vs_count) as cnt from {$g5['visit_sum_table']} "; + $row = sql_fetch($sql); + $vi_max = $row['cnt']; + + // 전체 + $sql = " select sum(vs_count) as total from {$g5['visit_sum_table']} "; + $row = sql_fetch($sql); + $vi_sum = $row['total']; + + $visit = '오늘:' . $vi_today . ',어제:' . $vi_yesterday . ',최대:' . $vi_max . ',전체:' . $vi_sum; + + // 기본설정 테이블에 방문자수를 기록한 후 + // 방문자수 테이블을 읽지 않고 출력한다. + // 쿼리의 수를 상당부분 줄임 + sql_query(" update {$g5['config_table']} set cf_visit = '{$visit}' "); + } } -?> diff --git a/AvocadoEdition_Light/bbs/write.php b/AvocadoEdition_Light/bbs/write.php index 74e7662..f6d958d 100644 --- a/AvocadoEdition_Light/bbs/write.php +++ b/AvocadoEdition_Light/bbs/write.php @@ -1,15 +1,15 @@ 0) ? $member['mb_point'] : 0; - if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) { - alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글쓰기('.number_format($board['bo_write_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글쓰기 해 주십시오.'); - } + // 음수도 true 인것을 왜 이제야 알았을까? + if ($is_member) { + $tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0; + if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) { + alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 글쓰기(' . number_format($board['bo_write_point']) . ')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글쓰기 해 주십시오.'); } + } - $title_msg = '글쓰기'; + $title_msg = '글쓰기'; } else if ($w == 'u') { - // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 - //if ($member['mb_level'] < $board['bo_write_level']) { - if($member['mb_id'] && $write['mb_id'] == $member['mb_id']) { - ; - } else if ($member['mb_level'] < $board['bo_write_level']) { - if ($member['mb_id']) { - alert('글을 수정할 권한이 없습니다.'); - } else { - alert('글을 수정할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); - } + // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 + //if ($member['mb_level'] < $board['bo_write_level']) { + if ($member['mb_id'] && $write['mb_id'] == $member['mb_id']) { + ; + } else if ($member['mb_level'] < $board['bo_write_level']) { + if ($member['mb_id']) { + alert('글을 수정할 권한이 없습니다.'); + } else { + alert('글을 수정할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?' . $qstr . '&url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table)); } + } - $len = strlen($write['wr_reply']); - if ($len < 0) $len = 0; - $reply = substr($write['wr_reply'], 0, $len); + $len = strlen($write['wr_reply']); + if ($len < 0) + $len = 0; + $reply = substr($write['wr_reply'], 0, $len); - // 원글만 구한다. - $sql = " select count(*) as cnt from {$write_table} + // 원글만 구한다. + $sql = " select count(*) as cnt from {$write_table} where wr_reply like '{$reply}%' and wr_id <> '{$write['wr_id']}' and wr_num = '{$write['wr_num']}' and wr_is_comment = 0 "; - $row = sql_fetch($sql); - if ($row['cnt'] && !$is_admin) - alert('이 글과 관련된 답변글이 존재하므로 수정 할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다.'); + $row = sql_fetch($sql); + if ($row['cnt'] && !$is_admin) + alert('이 글과 관련된 답변글이 존재하므로 수정 할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다.'); - // 코멘트 달린 원글의 수정 여부 - $sql = " select count(*) as cnt from {$write_table} + // 코멘트 달린 원글의 수정 여부 + $sql = " select count(*) as cnt from {$write_table} where wr_parent = '{$wr_id}' and mb_id <> '{$member['mb_id']}' and wr_is_comment = 1 "; - $row = sql_fetch($sql); - if ($board['bo_count_modify'] && $row['cnt'] >= $board['bo_count_modify'] && !$is_admin) - alert('이 글과 관련된 댓글이 존재하므로 수정 할 수 없습니다.\\n\\n댓글이 '.$board['bo_count_modify'].'건 이상 달린 원글은 수정할 수 없습니다.'); + $row = sql_fetch($sql); + if ($board['bo_count_modify'] && $row['cnt'] >= $board['bo_count_modify'] && !$is_admin) + alert('이 글과 관련된 댓글이 존재하므로 수정 할 수 없습니다.\\n\\n댓글이 ' . $board['bo_count_modify'] . '건 이상 달린 원글은 수정할 수 없습니다.'); - $title_msg = '글수정'; + $title_msg = '글수정'; } else if ($w == 'r') { - if ($member['mb_level'] < $board['bo_reply_level']) { - if ($member['mb_id']) - alert('글을 답변할 권한이 없습니다.'); - else - alert('답변글을 작성할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?'.$qstr.'&url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); - } - - $tmp_point = isset($member['mb_point']) ? $member['mb_point'] : 0; - if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) - alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 글답변('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글답변 해 주십시오.'); - - //if (preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice'])) - if (in_array((int)$wr_id, $notice_array)) - alert('공지에는 답변 할 수 없습니다.'); - - //---------- - // 4.06.13 : 비밀글을 타인이 열람할 수 있는 오류 수정 (헐랭이, 플록님께서 알려주셨습니다.) - // 코멘트에는 원글의 답변이 불가하므로 - if ($write['wr_is_comment']) - alert('정상적인 접근이 아닙니다.'); - - // 비밀글인지를 검사 - if (strstr($write['wr_option'], 'secret')) { - if ($write['mb_id']) { - // 회원의 경우는 해당 글쓴 회원 및 관리자 - if (!($write['mb_id'] == $member['mb_id'] || $is_admin)) - alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.'); - } else { - // 비회원의 경우는 비밀글에 답변이 불가함 - if (!$is_admin) - alert('비회원의 비밀글에는 답변이 불가합니다.'); - } - } - //---------- - - // 게시글 배열 참조 - $reply_array = &$write; - - // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. - if (strlen($reply_array['wr_reply']) == 10) - alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.'); - - $reply_len = strlen($reply_array['wr_reply']) + 1; - if ($board['bo_reply_order']) { - $begin_reply_char = 'A'; - $end_reply_char = 'Z'; - $reply_number = +1; - $sql = " select MAX(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; - } else { - $begin_reply_char = 'Z'; - $end_reply_char = 'A'; - $reply_number = -1; - $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; - } - if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; - $row = sql_fetch($sql); - - if (!$row['reply']) - $reply_char = $begin_reply_char; - else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다. - alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.'); + if ($member['mb_level'] < $board['bo_reply_level']) { + if ($member['mb_id']) + alert('글을 답변할 권한이 없습니다.'); else - $reply_char = chr(ord($row['reply']) + $reply_number); + alert('답변글을 작성할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', './login.php?' . $qstr . '&url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table)); + } - $reply = $reply_array['wr_reply'] . $reply_char; + $tmp_point = isset($member['mb_point']) ? $member['mb_point'] : 0; + if ($tmp_point + $board['bo_write_point'] < 0 && !$is_admin) + alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 글답변(' . number_format($board['bo_comment_point']) . ')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 글답변 해 주십시오.'); - $title_msg = '글답변'; + //if (preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice'])) + if (in_array((int) $wr_id, $notice_array)) + alert('공지에는 답변 할 수 없습니다.'); - $write['wr_subject'] = 'Re: '.$write['wr_subject']; + //---------- + // 4.06.13 : 비밀글을 타인이 열람할 수 있는 오류 수정 (헐랭이, 플록님께서 알려주셨습니다.) + // 코멘트에는 원글의 답변이 불가하므로 + if ($write['wr_is_comment']) + alert('정상적인 접근이 아닙니다.'); + + // 비밀글인지를 검사 + if (strstr($write['wr_option'], 'secret')) { + if ($write['mb_id']) { + // 회원의 경우는 해당 글쓴 회원 및 관리자 + if (!($write['mb_id'] == $member['mb_id'] || $is_admin)) + alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.'); + } else { + // 비회원의 경우는 비밀글에 답변이 불가함 + if (!$is_admin) + alert('비회원의 비밀글에는 답변이 불가합니다.'); + } + } + //---------- + + // 게시글 배열 참조 + $reply_array = &$write; + + // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. + if (strlen($reply_array['wr_reply']) == 10) + alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다.'); + + $reply_len = strlen($reply_array['wr_reply']) + 1; + if ($board['bo_reply_order']) { + $begin_reply_char = 'A'; + $end_reply_char = 'Z'; + $reply_number = +1; + $sql = " select MAX(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; + } else { + $begin_reply_char = 'Z'; + $end_reply_char = 'A'; + $reply_number = -1; + $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; + } + if ($reply_array['wr_reply']) + $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; + $row = sql_fetch($sql); + + if (!$row['reply']) + $reply_char = $begin_reply_char; + else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다. + alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.'); + else + $reply_char = chr(ord($row['reply']) + $reply_number); + + $reply = $reply_array['wr_reply'] . $reply_char; + + $title_msg = '글답변'; + + $write['wr_subject'] = 'Re: ' . $write['wr_subject']; } // 그룹접근 가능 if (!empty($group['gr_use_access'])) { - if ($is_guest) { - alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", 'login.php?'.$qstr.'&url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); - } + if ($is_guest) { + alert("접근 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.", 'login.php?' . $qstr . '&url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table)); + } - if ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']) { - ; // 통과 - } else { - // 그룹접근 - $sql = " select gr_id from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' "; - $row = sql_fetch($sql); - if (!$row['gr_id']) - alert('접근 권한이 없으므로 글쓰기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.'); - } + if ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']) { + ; // 통과 + } else { + // 그룹접근 + $sql = " select gr_id from {$g5['group_member_table']} where gr_id = '{$board['gr_id']}' and mb_id = '{$member['mb_id']}' "; + $row = sql_fetch($sql); + if (!$row['gr_id']) + alert('접근 권한이 없으므로 글쓰기가 불가합니다.\\n\\n궁금하신 사항은 관리자에게 문의 바랍니다.'); + } } // 본인확인을 사용한다면 if ($config['cf_cert_use'] && !$is_admin) { - // 인증된 회원만 가능 - if ($board['bo_use_cert'] != '' && $is_guest) { - alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', 'login.php?'.$qstr.'&url='.urlencode($_SERVER['SCRIPT_NAME'].'?bo_table='.$bo_table)); - } + // 인증된 회원만 가능 + if ($board['bo_use_cert'] != '' && $is_guest) { + alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오.', 'login.php?' . $qstr . '&url=' . urlencode($_SERVER['SCRIPT_NAME'] . '?bo_table=' . $bo_table)); + } - if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { - alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'cert' && !$member['mb_certify']) { + alert('이 게시판은 본인확인 하신 회원님만 글쓰기가 가능합니다.\\n\\n회원정보 수정에서 본인확인을 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { - alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글쓰기가 가능합니다.\\n\\n성인인데 글쓰기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'adult' && !$member['mb_adult']) { + alert('이 게시판은 본인확인으로 성인인증 된 회원님만 글쓰기가 가능합니다.\\n\\n성인인데 글쓰기가 안된다면 회원정보 수정에서 본인확인을 다시 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { - alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'hp-cert' && $member['mb_certify'] != 'hp') { + alert('이 게시판은 휴대폰 본인확인 하신 회원님만 글읽기가 가능합니다.\\n\\n회원정보 수정에서 휴대폰 본인확인을 해주시기 바랍니다.', G5_URL); + } - if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { - alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL); - } + if ($board['bo_use_cert'] == 'hp-adult' && (!$member['mb_adult'] || $member['mb_certify'] != 'hp')) { + alert('이 게시판은 휴대폰 본인확인으로 성인인증 된 회원님만 글읽기가 가능합니다.\\n\\n현재 성인인데 글읽기가 안된다면 회원정보 수정에서 휴대폰 본인확인을 다시 해주시기 바랍니다.', G5_URL); + } } // 글자수 제한 설정값 -if ($is_admin || $board['bo_use_dhtml_editor']) -{ - $write_min = $write_max = 0; -} -else -{ - $write_min = (int)$board['bo_write_min']; - $write_max = (int)$board['bo_write_max']; +if ($is_admin || $board['bo_use_dhtml_editor']) { + $write_min = $write_max = 0; +} else { + $write_min = (int) $board['bo_write_min']; + $write_max = (int) $board['bo_write_max']; } -$g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']).' '.$title_msg; +$g5['title'] = ((G5_IS_MOBILE && $board['bo_mobile_subject']) ? $board['bo_mobile_subject'] : $board['bo_subject']) . ' ' . $title_msg; $is_notice = false; $notice_checked = ''; if ($is_admin && $w != 'r') { - $is_notice = true; + $is_notice = true; - if ($w == 'u') { - // 답변 수정시 공지 체크 없음 - if ($write['wr_reply']) { - $is_notice = false; - } else { - if (in_array((int)$wr_id, $notice_array)) { - $notice_checked = 'checked'; - } - } + if ($w == 'u') { + // 답변 수정시 공지 체크 없음 + if ($write['wr_reply']) { + $is_notice = false; + } else { + if (in_array((int) $wr_id, $notice_array)) { + $notice_checked = 'checked'; + } } + } } $is_html = false; if ($member['mb_level'] >= $board['bo_html_level']) - $is_html = true; + $is_html = true; $is_secret = $board['bo_use_secret']; $is_mail = false; if ($config['cf_email_use'] && $board['bo_use_email']) - $is_mail = true; + $is_mail = true; $recv_email_checked = ''; if ($w == '' || strstr($write['wr_option'], 'mail')) - $recv_email_checked = 'checked'; + $recv_email_checked = 'checked'; -$is_name = false; +$is_name = false; $is_password = false; -$is_email = false; +$is_email = false; $is_homepage = false; if ($is_guest || ($is_admin && $w == 'u' && $member['mb_id'] != $write['mb_id'])) { - $is_name = true; - $is_password = true; - $is_email = true; - $is_homepage = true; + $is_name = true; + $is_password = true; + $is_email = true; + $is_homepage = true; } $is_category = false; $category_option = ''; if ($board['bo_use_category']) { - $ca_name = ""; - if (isset($write['ca_name'])) - $ca_name = $write['ca_name']; - $category_option = get_category_option($bo_table, $ca_name); - $is_category = true; + $ca_name = ""; + if (isset($write['ca_name'])) + $ca_name = $write['ca_name']; + $category_option = get_category_option($bo_table, $ca_name); + $is_category = true; } $is_link = false; if ($member['mb_level'] >= $board['bo_link_level']) { - $is_link = true; + $is_link = true; } $is_file = false; if ($member['mb_level'] >= $board['bo_upload_level']) { - $is_file = true; + $is_file = true; } $is_file_content = false; if ($board['bo_use_file_content']) { - $is_file_content = true; + $is_file_content = true; } -$file_count = (int)$board['bo_upload_count']; +$file_count = (int) $board['bo_upload_count']; -$name = ""; -$email = ""; +$name = ""; +$email = ""; $homepage = ""; if ($w == "" || $w == "r") { - if ($is_member) { - if (isset($write['wr_name'])) { - $name = get_text(cut_str(stripslashes($write['wr_name']),20)); - } - $email = get_email_address($member['mb_email']); - $homepage = get_text(stripslashes($member['mb_homepage'])); + if ($is_member) { + if (isset($write['wr_name'])) { + $name = get_text(cut_str(stripslashes($write['wr_name']), 20)); } + $email = get_email_address($member['mb_email']); + $homepage = get_text(stripslashes($member['mb_homepage'])); + } } -$html_checked = ""; -$html_value = ""; +$html_checked = ""; +$html_value = ""; $secret_checked = ""; if ($w == '') { - $password_required = 'required'; + $password_required = 'required'; } else if ($w == 'u') { - $password_required = ''; + $password_required = ''; - if (!$is_admin) { - if (!($is_member && $member['mb_id'] == $write['mb_id'])) { - if (!check_password($wr_password, $write['wr_password'])) { - alert('비밀번호가 틀립니다.'); - } - } + if (!$is_admin) { + if (!($is_member && $member['mb_id'] == $write['mb_id'])) { + if (!check_password($wr_password, $write['wr_password'])) { + alert('비밀번호가 틀립니다.'); + } } + } - $name = get_text(cut_str(stripslashes($write['wr_name']),20)); - $email = get_email_address($write['wr_email']); - $homepage = get_text(stripslashes($write['wr_homepage'])); + $name = get_text(cut_str(stripslashes($write['wr_name']), 20)); + $email = get_email_address($write['wr_email']); + $homepage = get_text(stripslashes($write['wr_homepage'])); - for ($i=1; $i<=G5_LINK_COUNT; $i++) { - $write['wr_link'.$i] = get_text($write['wr_link'.$i]); - $link[$i] = $write['wr_link'.$i]; - } + for ($i = 1; $i <= G5_LINK_COUNT; $i++) { + $write['wr_link' . $i] = get_text($write['wr_link' . $i]); + $link[$i] = $write['wr_link' . $i]; + } - if (strstr($write['wr_option'], 'html1')) { - $html_checked = 'checked'; - $html_value = 'html1'; - } else if (strstr($write['wr_option'], 'html2')) { - $html_checked = 'checked'; - $html_value = 'html2'; - } + if (strstr($write['wr_option'], 'html1')) { + $html_checked = 'checked'; + $html_value = 'html1'; + } else if (strstr($write['wr_option'], 'html2')) { + $html_checked = 'checked'; + $html_value = 'html2'; + } - if (strstr($write['wr_option'], 'secret')) { - $secret_checked = 'checked'; - } + if (strstr($write['wr_option'], 'secret')) { + $secret_checked = 'checked'; + } - $file = get_file($bo_table, $wr_id); - if($file_count < $file['count']) - $file_count = $file['count']; + $file = get_file($bo_table, $wr_id); + if ($file_count < $file['count']) + $file_count = $file['count']; } else if ($w == 'r') { - if (strstr($write['wr_option'], 'secret')) { - $is_secret = true; - $secret_checked = 'checked'; - } + if (strstr($write['wr_option'], 'secret')) { + $is_secret = true; + $secret_checked = 'checked'; + } - $password_required = "required"; + $password_required = "required"; - for ($i=1; $i<=G5_LINK_COUNT; $i++) { - $write['wr_link'.$i] = get_text($write['wr_link'.$i]); - } + for ($i = 1; $i <= G5_LINK_COUNT; $i++) { + $write['wr_link' . $i] = get_text($write['wr_link' . $i]); + } } set_session('ss_bo_table', $_REQUEST['bo_table']); @@ -358,52 +357,52 @@ set_session('ss_wr_id', $_REQUEST['wr_id']); $subject = ""; if (isset($write['wr_subject'])) { - $subject = str_replace("\"", """, get_text(cut_str($write['wr_subject'], 255), 0)); + $subject = str_replace("\"", """, get_text(cut_str($write['wr_subject'], 255), 0)); } $content = ''; if ($w == '') { - $content = $board['bo_insert_content']; + $content = $board['bo_insert_content']; } else if ($w == 'r') { - if (!strstr($write['wr_option'], 'html')) { - $content = "\n\n\n > " - ."\n > " - ."\n > ".str_replace("\n", "\n> ", get_text($write['wr_content'], 0)) - ."\n > " - ."\n > "; + if (!strstr($write['wr_option'], 'html')) { + $content = "\n\n\n > " + . "\n > " + . "\n > " . str_replace("\n", "\n> ", get_text($write['wr_content'], 0)) + . "\n > " + . "\n > "; - } + } } else { - $content = get_text($write['wr_content'], 0); + $content = get_text($write['wr_content'], 0); } $upload_max_filesize = number_format($board['bo_upload_size']) . ' 바이트'; $width = $board['bo_table_width']; if ($width <= 100) - $width .= '%'; + $width .= '%'; else - $width .= 'px'; + $width .= 'px'; $captcha_html = ''; -$captcha_js = ''; +$captcha_js = ''; if ($is_guest) { - $captcha_html = captcha_html(); - $captcha_js = chk_captcha_js(); + $captcha_html = captcha_html(); + $captcha_js = chk_captcha_js(); } $is_dhtml_editor = false; $is_dhtml_editor_use = false; $editor_content_js = ''; -if(!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE) - $is_dhtml_editor_use = true; +if (!is_mobile() || defined('G5_IS_MOBILE_DHTML_USE') && G5_IS_MOBILE_DHTML_USE) + $is_dhtml_editor_use = true; // 모바일에서는 G5_IS_MOBILE_DHTML_USE 설정에 따라 DHTML 에디터 적용 if ($config['cf_editor'] && $is_dhtml_editor_use && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $board['bo_html_level']) { - $is_dhtml_editor = true; + $is_dhtml_editor = true; - if(is_file(G5_EDITOR_PATH.'/'.$config['cf_editor'].'/autosave.editor.js')) - $editor_content_js = ''.PHP_EOL; + if (is_file(G5_EDITOR_PATH . '/' . $config['cf_editor'] . '/autosave.editor.js')) + $editor_content_js = '' . PHP_EOL; } $editor_html = editor_html('wr_content', $content, $is_dhtml_editor); $editor_js = ''; @@ -413,16 +412,15 @@ $editor_js .= chk_editor_js('wr_content', $is_dhtml_editor); // 임시 저장된 글 수 $autosave_count = autosave_count($member['mb_id']); -include_once(G5_PATH.'/head.sub.php'); -@include_once ($board_skin_path.'/write.head.skin.php'); +include_once(G5_PATH . '/head.sub.php'); +@include_once($board_skin_path . '/write.head.skin.php'); include_once('./board_head.php'); -$action_url = https_url(G5_BBS_DIR)."/write_update.php"; +$action_url = https_url(G5_BBS_DIR) . "/write_update.php"; -echo ''; -include_once ($board_skin_path.'/write.skin.php'); +echo ''; +include_once($board_skin_path . '/write.skin.php'); include_once('./board_tail.php'); -@include_once ($board_skin_path.'/write.tail.skin.php'); -include_once(G5_PATH.'/tail.sub.php'); -?> \ No newline at end of file +@include_once($board_skin_path . '/write.tail.skin.php'); +include_once(G5_PATH . '/tail.sub.php'); diff --git a/AvocadoEdition_Light/bbs/write_comment_update.php b/AvocadoEdition_Light/bbs/write_comment_update.php index 880261f..19a908a 100644 --- a/AvocadoEdition_Light/bbs/write_comment_update.php +++ b/AvocadoEdition_Light/bbs/write_comment_update.php @@ -1,7 +1,7 @@ 50) { - alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); - exit; + alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); + exit; } -@include_once($board_skin_path.'/write_comment_update.head.skin.php'); +@include_once($board_skin_path . '/write_comment_update.head.skin.php'); $w = $_POST["w"]; -$wr_name = trim($_POST['wr_name']); +$wr_name = trim($_POST['wr_name']); $wr_email = ''; if (!empty($_POST['wr_email'])) - $wr_email = get_email_address(trim($_POST['wr_email'])); + $wr_email = get_email_address(trim($_POST['wr_email'])); // 비회원의 경우 이름이 누락되는 경우가 있음 if ($is_guest) { - if ($wr_name == '') - alert('이름은 필히 입력하셔야 합니다.'); - if(!chk_captcha()) - alert('자동등록방지 숫자가 틀렸습니다.'); + if ($wr_name == '') + alert('이름은 필히 입력하셔야 합니다.'); + if (!chk_captcha()) + alert('자동등록방지 숫자가 틀렸습니다.'); } if ($w == "c" || $w == "cu") { - if ($member['mb_level'] < $board['bo_comment_level']) - alert('댓글을 쓸 권한이 없습니다.'); -} -else - alert('w 값이 제대로 넘어오지 않았습니다.'); + if ($member['mb_level'] < $board['bo_comment_level']) + alert('댓글을 쓸 권한이 없습니다.'); +} else + alert('w 값이 제대로 넘어오지 않았습니다.'); // 세션의 시간 검사 // 4.00.15 - 댓글 수정시 연속 게시물 등록 메시지로 인한 오류 수정 if ($w == 'c' && $_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin) - alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.'); + alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.'); set_session('ss_datetime', G5_SERVER_TIME); $wr = get_write($write_table, $wr_id); if (empty($wr['wr_id'])) - alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다."); + alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다."); // "인터넷옵션 > 보안 > 사용자정의수준 > 스크립팅 > Action 스크립팅 > 사용 안 함" 일 경우의 오류 처리 // 이 옵션을 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다. //if (!trim($_POST["wr_content"])) die ("내용을 입력하여 주십시오."); -if ($is_member) -{ - $mb_id = $member['mb_id']; - // 4.00.13 - 실명 사용일때 댓글에 닉네임으로 입력되던 오류를 수정 - $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); - $wr_password = $member['mb_password']; - $wr_email = addslashes($member['mb_email']); - $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); -} -else -{ - $mb_id = ''; - $wr_password = get_encrypt_string($wr_password); +if ($is_member) { + $mb_id = $member['mb_id']; + // 4.00.13 - 실명 사용일때 댓글에 닉네임으로 입력되던 오류를 수정 + $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); + $wr_password = $member['mb_password']; + $wr_email = addslashes($member['mb_email']); + $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); +} else { + $mb_id = ''; + $wr_password = get_encrypt_string($wr_password); } if ($w == 'c') // 댓글 입력 { - /* - if ($member['mb_point'] + $board['bo_comment_point'] < 0 && !$is_admin) - alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 댓글쓰기('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.'); - */ - // 댓글쓰기 포인트설정시 회원의 포인트가 음수인 경우 댓글을 쓰지 못하던 버그를 수정 (곱슬최씨님) - $tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0; - if ($tmp_point + $board['bo_comment_point'] < 0 && !$is_admin) - alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 댓글쓰기('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.'); + /* + if ($member['mb_point'] + $board['bo_comment_point'] < 0 && !$is_admin) + alert('보유하신 포인트('.number_format($member['mb_point']).')가 없거나 모자라서 댓글쓰기('.number_format($board['bo_comment_point']).')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.'); + */ + // 댓글쓰기 포인트설정시 회원의 포인트가 음수인 경우 댓글을 쓰지 못하던 버그를 수정 (곱슬최씨님) + $tmp_point = ($member['mb_point'] > 0) ? $member['mb_point'] : 0; + if ($tmp_point + $board['bo_comment_point'] < 0 && !$is_admin) + alert('보유하신 포인트(' . number_format($member['mb_point']) . ')가 없거나 모자라서 댓글쓰기(' . number_format($board['bo_comment_point']) . ')가 불가합니다.\\n\\n포인트를 적립하신 후 다시 댓글을 써 주십시오.'); - // 댓글 답변 - if ($comment_id) - { - $sql = " select wr_id, wr_parent, wr_comment, wr_comment_reply from $write_table + // 댓글 답변 + if ($comment_id) { + $sql = " select wr_id, wr_parent, wr_comment, wr_comment_reply from $write_table where wr_id = '$comment_id' "; - $reply_array = sql_fetch($sql); - if (!$reply_array['wr_id']) - alert('답변할 댓글이 없습니다.\\n\\n답변하는 동안 댓글이 삭제되었을 수 있습니다.'); + $reply_array = sql_fetch($sql); + if (!$reply_array['wr_id']) + alert('답변할 댓글이 없습니다.\\n\\n답변하는 동안 댓글이 삭제되었을 수 있습니다.'); - if($wr['wr_parent'] != $reply_array['wr_parent']) - alert('댓글을 등록할 수 없습니다.'); + if ($wr['wr_parent'] != $reply_array['wr_parent']) + alert('댓글을 등록할 수 없습니다.'); - $tmp_comment = $reply_array['wr_comment']; + $tmp_comment = $reply_array['wr_comment']; - if (strlen($reply_array['wr_comment_reply']) == 5) - alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 5단계 까지만 가능합니다.'); + if (strlen($reply_array['wr_comment_reply']) == 5) + alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 5단계 까지만 가능합니다.'); - $reply_len = strlen($reply_array['wr_comment_reply']) + 1; - if ($board['bo_reply_order']) { - $begin_reply_char = 'A'; - $end_reply_char = 'Z'; - $reply_number = +1; - $sql = " select MAX(SUBSTRING(wr_comment_reply, $reply_len, 1)) as reply + $reply_len = strlen($reply_array['wr_comment_reply']) + 1; + if ($board['bo_reply_order']) { + $begin_reply_char = 'A'; + $end_reply_char = 'Z'; + $reply_number = +1; + $sql = " select MAX(SUBSTRING(wr_comment_reply, $reply_len, 1)) as reply from $write_table where wr_parent = '$wr_id' and wr_comment = '$tmp_comment' and SUBSTRING(wr_comment_reply, $reply_len, 1) <> '' "; - } - else - { - $begin_reply_char = 'Z'; - $end_reply_char = 'A'; - $reply_number = -1; - $sql = " select MIN(SUBSTRING(wr_comment_reply, $reply_len, 1)) as reply + } else { + $begin_reply_char = 'Z'; + $end_reply_char = 'A'; + $reply_number = -1; + $sql = " select MIN(SUBSTRING(wr_comment_reply, $reply_len, 1)) as reply from $write_table where wr_parent = '$wr_id' and wr_comment = '$tmp_comment' and SUBSTRING(wr_comment_reply, $reply_len, 1) <> '' "; - } - if ($reply_array['wr_comment_reply']) - $sql .= " and wr_comment_reply like '{$reply_array['wr_comment_reply']}%' "; - $row = sql_fetch($sql); - - if (!$row['reply']) - $reply_char = $begin_reply_char; - else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다. - alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.'); - else - $reply_char = chr(ord($row['reply']) + $reply_number); - - $tmp_comment_reply = $reply_array['wr_comment_reply'] . $reply_char; } + if ($reply_array['wr_comment_reply']) + $sql .= " and wr_comment_reply like '{$reply_array['wr_comment_reply']}%' "; + $row = sql_fetch($sql); + + if (!$row['reply']) + $reply_char = $begin_reply_char; + else if ($row['reply'] == $end_reply_char) // A~Z은 26 입니다. + alert('더 이상 답변하실 수 없습니다.\\n\\n답변은 26개 까지만 가능합니다.'); else - { - $sql = " select max(wr_comment) as max_comment from $write_table + $reply_char = chr(ord($row['reply']) + $reply_number); + + $tmp_comment_reply = $reply_array['wr_comment_reply'] . $reply_char; + } else { + $sql = " select max(wr_comment) as max_comment from $write_table where wr_parent = '$wr_id' and wr_is_comment = 1 "; - $row = sql_fetch($sql); - //$row['max_comment'] -= 1; - $row['max_comment'] += 1; - $tmp_comment = $row['max_comment']; - $tmp_comment_reply = ''; - } + $row = sql_fetch($sql); + //$row['max_comment'] -= 1; + $row['max_comment'] += 1; + $tmp_comment = $row['max_comment']; + $tmp_comment_reply = ''; + } - //$wr_subject = get_text(stripslashes($wr['wr_subject'])); + //$wr_subject = get_text(stripslashes($wr['wr_subject'])); - $sql = " insert into $write_table + $sql = " insert into $write_table set ca_name = '{$wr['ca_name']}', wr_option = '$wr_secret', wr_num = '{$wr['wr_num']}', @@ -161,7 +152,7 @@ if ($w == 'c') // 댓글 입력 wr_name = '$wr_name', wr_email = '$wr_email', wr_homepage = '$wr_homepage', - wr_datetime = '".G5_TIME_YMDHIS."', + wr_datetime = '" . G5_TIME_YMDHIS . "', wr_last = '', wr_ip = '{$_SERVER['REMOTE_ADDR']}', @@ -183,144 +174,147 @@ if ($w == 'c') // 댓글 입력 wr_8 = '$wr_8', wr_9 = '$wr_9', wr_10 = '$wr_10' "; - sql_query($sql); + sql_query($sql); - $comment_id = sql_insert_id(); + $comment_id = sql_insert_id(); - // 원글에 댓글수 증가 & 마지막 시간 반영 - sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '".G5_TIME_YMDHIS."' where wr_id = '$wr_id' "); + // 원글에 댓글수 증가 & 마지막 시간 반영 + sql_query(" update $write_table set wr_comment = wr_comment + 1, wr_last = '" . G5_TIME_YMDHIS . "' where wr_id = '$wr_id' "); - // 새글 INSERT - sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) "); + // 새글 INSERT + sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '$bo_table', '$comment_id', '$wr_id', '" . G5_TIME_YMDHIS . "', '{$member['mb_id']}' ) "); - // 댓글 1 증가 - sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' "); + // 댓글 1 증가 + sql_query(" update {$g5['board_table']} set bo_count_comment = bo_count_comment + 1 where bo_table = '$bo_table' "); - // 포인트 부여 - insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글'); + // 포인트 부여 + insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id}-{$comment_id} 댓글쓰기", $bo_table, $comment_id, '댓글'); - // 메일발송 사용 - if ($config['cf_email_use'] && $board['bo_use_email']) - { - // 관리자의 정보를 얻고 - $super_admin = get_admin('super'); - $group_admin = get_admin('group'); - $board_admin = get_admin('board'); + // 메일발송 사용 + if ($config['cf_email_use'] && $board['bo_use_email']) { + // 관리자의 정보를 얻고 + $super_admin = get_admin('super'); + $group_admin = get_admin('group'); + $board_admin = get_admin('board'); - $wr_content = nl2br(get_text(stripslashes("원글\n{$wr['wr_subject']}\n\n\n댓글\n$wr_content"))); + $wr_content = nl2br(get_text(stripslashes("원글\n{$wr['wr_subject']}\n\n\n댓글\n$wr_content"))); - $warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'댓글 ', 'cu'=>'댓글 수정' ); - $str = $warr[$w]; + $warr = array('' => '입력', 'u' => '수정', 'r' => '답변', 'c' => '댓글 ', 'cu' => '댓글 수정'); + $str = $warr[$w]; - $subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' 게시판에 '.$str.'글이 올라왔습니다.'; - // 4.00.15 - 메일로 보내는 댓글의 바로가기 링크 수정 - $link_url = G5_BBS_URL."/board.php?bo_table=".$bo_table."&wr_id=".$wr_id."&".$qstr."#c_".$comment_id; + $subject = '[' . $config['cf_title'] . '] ' . $board['bo_subject'] . ' 게시판에 ' . $str . '글이 올라왔습니다.'; + // 4.00.15 - 메일로 보내는 댓글의 바로가기 링크 수정 + $link_url = G5_BBS_URL . "/board.php?bo_table=" . $bo_table . "&wr_id=" . $wr_id . "&" . $qstr . "#c_" . $comment_id; - include_once(G5_LIB_PATH.'/mailer.lib.php'); + include_once(G5_LIB_PATH . '/mailer.lib.php'); - ob_start(); - include_once ('./write_update_mail.php'); - $content = ob_get_contents(); - ob_end_clean(); + ob_start(); + include_once('./write_update_mail.php'); + $content = ob_get_contents(); + ob_end_clean(); - $array_email = array(); - // 게시판관리자에게 보내는 메일 - if ($config['cf_email_wr_board_admin']) $array_email[] = $board_admin['mb_email']; - // 게시판그룹관리자에게 보내는 메일 - if ($config['cf_email_wr_group_admin']) $array_email[] = $group_admin['mb_email']; - // 최고관리자에게 보내는 메일 - if ($config['cf_email_wr_super_admin']) $array_email[] = $super_admin['mb_email']; + $array_email = array(); + // 게시판관리자에게 보내는 메일 + if ($config['cf_email_wr_board_admin']) + $array_email[] = $board_admin['mb_email']; + // 게시판그룹관리자에게 보내는 메일 + if ($config['cf_email_wr_group_admin']) + $array_email[] = $group_admin['mb_email']; + // 최고관리자에게 보내는 메일 + if ($config['cf_email_wr_super_admin']) + $array_email[] = $super_admin['mb_email']; - // 원글게시자에게 보내는 메일 - if ($config['cf_email_wr_write']) $array_email[] = $wr['wr_email']; + // 원글게시자에게 보내는 메일 + if ($config['cf_email_wr_write']) + $array_email[] = $wr['wr_email']; - // 댓글 쓴 모든이에게 메일 발송이 되어 있다면 (자신에게는 발송하지 않는다) - if ($config['cf_email_wr_comment_all']) { - $sql = " select distinct wr_email from {$write_table} + // 댓글 쓴 모든이에게 메일 발송이 되어 있다면 (자신에게는 발송하지 않는다) + if ($config['cf_email_wr_comment_all']) { + $sql = " select distinct wr_email from {$write_table} where wr_email not in ( '{$wr['wr_email']}', '{$member['mb_email']}', '' ) and wr_parent = '$wr_id' "; - $result = sql_query($sql); - while ($row=sql_fetch_array($result)) - $array_email[] = $row['wr_email']; - } - - // 중복된 메일 주소는 제거 - $unique_email = array_unique($array_email); - $unique_email = array_values($unique_email); - for ($i=0; $i= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 ; - else if ($is_admin == 'group') { // 그룹관리자 - $mb = get_member($comment['mb_id']); - if ($member['mb_id'] == $group['gr_admin']) { // 자신이 관리하는 그룹인가? - if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - ; - else - alert('그룹관리자의 권한보다 높은 회원의 댓글이므로 수정할 수 없습니다.'); - } else - alert('자신이 관리하는 그룹의 게시판이 아니므로 댓글을 수정할 수 없습니다.'); - } else if ($is_admin == 'board') { // 게시판관리자이면 - $mb = get_member($comment['mb_id']); - if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가? - if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - ; - else - alert('게시판관리자의 권한보다 높은 회원의 댓글이므로 수정할 수 없습니다.'); - } else - alert('자신이 관리하는 게시판이 아니므로 댓글을 수정할 수 없습니다.'); - } else if ($member['mb_id']) { - if ($member['mb_id'] != $comment['mb_id']) - alert('자신의 글이 아니므로 수정할 수 없습니다.'); - } else { - if($comment['wr_password'] != $wr_password) - alert('댓글을 수정할 권한이 없습니다.'); - } + else + alert('그룹관리자의 권한보다 높은 회원의 댓글이므로 수정할 수 없습니다.'); + } else + alert('자신이 관리하는 그룹의 게시판이 아니므로 댓글을 수정할 수 없습니다.'); + } else if ($is_admin == 'board') { // 게시판관리자이면 + $mb = get_member($comment['mb_id']); + if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가? + if ($member['mb_level'] >= $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + ; + else + alert('게시판관리자의 권한보다 높은 회원의 댓글이므로 수정할 수 없습니다.'); + } else + alert('자신이 관리하는 게시판이 아니므로 댓글을 수정할 수 없습니다.'); + } else if ($member['mb_id']) { + if ($member['mb_id'] != $comment['mb_id']) + alert('자신의 글이 아니므로 수정할 수 없습니다.'); + } else { + if ($comment['wr_password'] != $wr_password) + alert('댓글을 수정할 권한이 없습니다.'); + } - $sql = " select count(*) as cnt from $write_table + $sql = " select count(*) as cnt from $write_table where wr_comment_reply like '$comment_reply%' and wr_id <> '$comment_id' and wr_parent = '$wr_id' and wr_comment = '$tmp_comment' and wr_is_comment = 1 "; - $row = sql_fetch($sql); - if ($row['cnt'] && !$is_admin) - alert('이 댓글와 관련된 답변댓글이 존재하므로 수정 할 수 없습니다.'); + $row = sql_fetch($sql); + if ($row['cnt'] && !$is_admin) + alert('이 댓글와 관련된 답변댓글이 존재하므로 수정 할 수 없습니다.'); - $sql_ip = ""; - if (!$is_admin) - $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; + $sql_ip = ""; + if (!$is_admin) + $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; - $sql_secret = ""; - if ($wr_secret) - $sql_secret = " , wr_option = '$wr_secret' "; + $sql_secret = ""; + if ($wr_secret) + $sql_secret = " , wr_option = '$wr_secret' "; - $sql = " update $write_table + $sql = " update $write_table set wr_subject = '$wr_subject', wr_content = '$wr_content', wr_1 = '$wr_1', @@ -337,14 +331,13 @@ else if ($w == 'cu') // 댓글 수정 $sql_ip $sql_secret where wr_id = '$comment_id' "; - sql_query($sql); + sql_query($sql); } // 사용자 코드 실행 -@include_once($board_skin_path.'/write_comment_update.skin.php'); -@include_once($board_skin_path.'/write_comment_update.tail.skin.php'); +@include_once($board_skin_path . '/write_comment_update.skin.php'); +@include_once($board_skin_path . '/write_comment_update.tail.skin.php'); delete_cache_latest($bo_table); -goto_url('./board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&'.$qstr.'&#c_'.$comment_id); -?> +goto_url('./board.php?bo_table=' . $bo_table . '&wr_id=' . $wr['wr_parent'] . '&' . $qstr . '&#c_' . $comment_id); diff --git a/AvocadoEdition_Light/bbs/write_comment_update.sns.php b/AvocadoEdition_Light/bbs/write_comment_update.sns.php index e991e60..aec35c0 100644 --- a/AvocadoEdition_Light/bbs/write_comment_update.sns.php +++ b/AvocadoEdition_Light/bbs/write_comment_update.sns.php @@ -1,45 +1,49 @@ $config['cf_facebook_appid'], - 'secret' => $config['cf_facebook_secret'] - )); + $facebook = new Facebook(array( + 'appId' => $config['cf_facebook_appid'], + 'secret' => $config['cf_facebook_secret'] + )); - $user = $facebook->getUser(); + $user = $facebook->getUser(); - if ($user) { - try { - $link = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&#c_'.$comment_id; - $attachment = array( - 'message' => stripslashes($wr_content), - 'name' => $wr_subject, - 'link' => $link, - 'description' => stripslashes(strip_tags($wr['wr_content'])) - ); - // 등록 - $facebook->api('/me/feed/', 'post', $attachment); - //$errors = error_get_last(); print_r2($errros); exit; + if ($user) { + try { + $link = G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr['wr_parent'] . '&#c_' . $comment_id; + $attachment = array( + 'message' => stripslashes($wr_content), + 'name' => $wr_subject, + 'link' => $link, + 'description' => stripslashes(strip_tags($wr['wr_content'])) + ); + // 등록 + $facebook->api('/me/feed/', 'post', $attachment); + //$errors = error_get_last(); print_r2($errros); exit; - set_cookie('ck_facebook_checked', true, 86400*31); - } catch(FacebookApiException $e) { - ;;; - } + set_cookie('ck_facebook_checked', true, 86400 * 31); + } catch (FacebookApiException $e) { + ; + ; + ; } + } - $wr_facebook_user = get_session("ss_facebook_user"); + $wr_facebook_user = get_session("ss_facebook_user"); } //============================================================================ @@ -49,24 +53,23 @@ if ($_POST['facebook_checked']) { //---------------------------------------------------------------------------- $wr_twitter_user = ""; if ($_POST['twitter_checked']) { - include_once(G5_SNS_PATH."/twitter/twitteroauth/twitteroauth.php"); - include_once(G5_SNS_PATH."/twitter/twitterconfig.php"); + include_once(G5_SNS_PATH . "/twitter/twitteroauth/twitteroauth.php"); + include_once(G5_SNS_PATH . "/twitter/twitterconfig.php"); - if ( !(empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret'])) ) { - $comment_url = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr['wr_parent'].'&#c_'.$comment_id; + if (!(empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret']))) { + $comment_url = G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr['wr_parent'] . '&#c_' . $comment_id; - $post = googl_short_url($comment_url).' '.$wr_content; - $post = utf8_strcut($post, 140); + $post = googl_short_url($comment_url) . ' ' . $wr_content; + $post = utf8_strcut($post, 140); - $access_token = $_SESSION['access_token']; - $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); - // 등록 - $connection->post('statuses/update', array('status' => $post)); + $access_token = $_SESSION['access_token']; + $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']); + // 등록 + $connection->post('statuses/update', array('status' => $post)); - set_cookie('ck_twitter_checked', true, 86400*31); - } + set_cookie('ck_twitter_checked', true, 86400 * 31); + } - $wr_twitter_user = get_session("ss_twitter_user"); + $wr_twitter_user = get_session("ss_twitter_user"); } //============================================================================ -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/bbs/write_token.php b/AvocadoEdition_Light/bbs/write_token.php index e8578ef..7a1a469 100644 --- a/AvocadoEdition_Light/bbs/write_token.php +++ b/AvocadoEdition_Light/bbs/write_token.php @@ -1,13 +1,12 @@ '게시판 정보가 올바르지 않습니다.', 'url'=>G5_URL))); +if (!$bo_table) + die(json_encode(array('error' => '게시판 정보가 올바르지 않습니다.', 'url' => G5_URL))); -set_session('ss_write_'.$bo_table.'_token', ''); +set_session('ss_write_' . $bo_table . '_token', ''); $token = get_write_token($bo_table); -die(json_encode(array('error'=>'', 'token'=>$token, 'url'=>''))); -?> \ No newline at end of file +die(json_encode(array('error' => '', 'token' => $token, 'url' => ''))); diff --git a/AvocadoEdition_Light/bbs/write_update.php b/AvocadoEdition_Light/bbs/write_update.php index 30f6674..fc635a6 100644 --- a/AvocadoEdition_Light/bbs/write_update.php +++ b/AvocadoEdition_Light/bbs/write_update.php @@ -1,7 +1,7 @@ 분류를 선택하세요.'; - } else { - $categories = array_map('trim', explode("|", $board['bo_category_list'].($is_admin ? '|공지' : ''))); - if(!empty($categories) && !in_array($ca_name, $categories)) - $msg[] = '분류를 올바르게 입력하세요.'; +if ($board['bo_use_category']) { + $ca_name = trim($_POST['ca_name']); + if (!$ca_name) { + $msg[] = '분류를 선택하세요.'; + } else { + $categories = array_map('trim', explode("|", $board['bo_category_list'] . ($is_admin ? '|공지' : ''))); + if (!empty($categories) && !in_array($ca_name, $categories)) + $msg[] = '분류를 올바르게 입력하세요.'; - if(empty($categories)) - $ca_name = ''; - } + if (empty($categories)) + $ca_name = ''; + } } else { - $ca_name = ''; + $ca_name = ''; } $wr_subject = ''; if (isset($_POST['wr_subject'])) { - $wr_subject = substr(trim($_POST['wr_subject']),0,255); - $wr_subject = preg_replace("#[\\\]+$#", "", $wr_subject); + $wr_subject = substr(trim($_POST['wr_subject']), 0, 255); + $wr_subject = preg_replace("#[\\\]+$#", "", $wr_subject); } if ($wr_subject == '') { - $msg[] = '제목을 입력하세요.'; + $msg[] = '제목을 입력하세요.'; } $wr_content = ''; if (isset($_POST['wr_content'])) { - $wr_content = substr(trim($_POST['wr_content']),0,65536); - $wr_content = preg_replace("#[\\\]+$#", "", $wr_content); + $wr_content = substr(trim($_POST['wr_content']), 0, 65536); + $wr_content = preg_replace("#[\\\]+$#", "", $wr_content); } /*if ($wr_content == '') { $msg[] = '내용을 입력하세요.'; @@ -46,197 +46,198 @@ if (isset($_POST['wr_content'])) { $wr_link1 = ''; if (isset($_POST['wr_link1'])) { - $wr_link1 = substr($_POST['wr_link1'],0,1000); - $wr_link1 = trim(strip_tags($wr_link1)); - $wr_link1 = preg_replace("#[\\\]+$#", "", $wr_link1); + $wr_link1 = substr($_POST['wr_link1'], 0, 1000); + $wr_link1 = trim(strip_tags($wr_link1)); + $wr_link1 = preg_replace("#[\\\]+$#", "", $wr_link1); } $wr_link2 = ''; if (isset($_POST['wr_link2'])) { - $wr_link2 = substr($_POST['wr_link2'],0,1000); - $wr_link2 = trim(strip_tags($wr_link2)); - $wr_link2 = preg_replace("#[\\\]+$#", "", $wr_link2); + $wr_link2 = substr($_POST['wr_link2'], 0, 1000); + $wr_link2 = trim(strip_tags($wr_link2)); + $wr_link2 = preg_replace("#[\\\]+$#", "", $wr_link2); } $msg = implode('
    ', $msg); if ($msg) { - alert($msg); + alert($msg); } // 090710 if (substr_count($wr_content, '&#') > 50) { - alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); - exit; + alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); + exit; } $upload_max_filesize = ini_get('upload_max_filesize'); if (empty($_POST)) { - alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n게시판관리자 또는 서버관리자에게 문의 바랍니다."); + alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=" . ini_get('post_max_size') . " , upload_max_filesize=" . $upload_max_filesize . "\\n게시판관리자 또는 서버관리자에게 문의 바랍니다."); } $notice_array = explode(",", $board['bo_notice']); if ($w == 'u' || $w == 'r') { - $wr = get_write($write_table, $wr_id); - if (!$wr['wr_id']) { - alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다."); - } + $wr = get_write($write_table, $wr_id); + if (!$wr['wr_id']) { + alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다."); + } } // 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글은 사용일 경우에만 가능해야 함 if (!$is_admin && !$board['bo_use_secret'] && (stripos($_POST['html'], 'secret') !== false || stripos($_POST['secret'], 'secret') !== false || stripos($_POST['mail'], 'secret') !== false)) { - alert('비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.'); + alert('비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.'); } $secret = ''; if (isset($_POST['secret']) && $_POST['secret']) { - if(preg_match('#secret#', strtolower($_POST['secret']), $matches)) - $secret = $matches[0]; + if (preg_match('#secret#', strtolower($_POST['secret']), $matches)) + $secret = $matches[0]; } // 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록 if (!$is_admin && $board['bo_use_secret'] == 2) { - $secret = 'secret'; + $secret = 'secret'; } $html = ''; if (isset($_POST['html']) && $_POST['html']) { - if(preg_match('#html(1|2)#', strtolower($_POST['html']), $matches)) - $html = $matches[0]; + if (preg_match('#html(1|2)#', strtolower($_POST['html']), $matches)) + $html = $matches[0]; } $mail = ''; if (isset($_POST['mail']) && $_POST['mail']) { - if(preg_match('#mail#', strtolower($_POST['mail']), $matches)) - $mail = $matches[0]; + if (preg_match('#mail#', strtolower($_POST['mail']), $matches)) + $mail = $matches[0]; } $notice = ''; if (isset($_POST['notice']) && $_POST['notice']) { - $notice = $_POST['notice']; + $notice = $_POST['notice']; } -for ($i=1; $i<=10; $i++) { - $var = "wr_$i"; - $$var = ""; - if (isset($_POST['wr_'.$i]) && settype($_POST['wr_'.$i], 'string')) { - $$var = trim($_POST['wr_'.$i]); - } +for ($i = 1; $i <= 10; $i++) { + $var = "wr_$i"; + $$var = ""; + if (isset($_POST['wr_' . $i]) && settype($_POST['wr_' . $i], 'string')) { + $$var = trim($_POST['wr_' . $i]); + } } -@include_once($board_skin_path.'/write_update.head.skin.php'); +@include_once($board_skin_path . '/write_update.head.skin.php'); if ($w == '' || $w == 'u') { - // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 - if($w =='u' && $member['mb_id'] && $wr['mb_id'] == $member['mb_id']) { - ; - } else if ($member['mb_level'] < $board['bo_write_level']) { - alert('글을 쓸 권한이 없습니다.'); - } + // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 + if ($w == 'u' && $member['mb_id'] && $wr['mb_id'] == $member['mb_id']) { + ; + } else if ($member['mb_level'] < $board['bo_write_level']) { + alert('글을 쓸 권한이 없습니다.'); + } - // 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함 - if (!$is_admin && $notice) { - alert('관리자만 공지할 수 있습니다.'); - } + // 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함 + if (!$is_admin && $notice) { + alert('관리자만 공지할 수 있습니다.'); + } } else if ($w == 'r') { - if (in_array((int)$wr_id, $notice_array)) { - alert('공지에는 답변 할 수 없습니다.'); - } + if (in_array((int) $wr_id, $notice_array)) { + alert('공지에는 답변 할 수 없습니다.'); + } - if ($member['mb_level'] < $board['bo_reply_level']) { - alert('글을 답변할 권한이 없습니다.'); - } + if ($member['mb_level'] < $board['bo_reply_level']) { + alert('글을 답변할 권한이 없습니다.'); + } - // 게시글 배열 참조 - $reply_array = &$wr; + // 게시글 배열 참조 + $reply_array = &$wr; - // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. - if (strlen($reply_array['wr_reply']) == 10) { - alert("더 이상 답변하실 수 없습니다.\\n답변은 10단계 까지만 가능합니다."); - } + // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. + if (strlen($reply_array['wr_reply']) == 10) { + alert("더 이상 답변하실 수 없습니다.\\n답변은 10단계 까지만 가능합니다."); + } - $reply_len = strlen($reply_array['wr_reply']) + 1; - if ($board['bo_reply_order']) { - $begin_reply_char = 'A'; - $end_reply_char = 'Z'; - $reply_number = +1; - $sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; - } else { - $begin_reply_char = 'Z'; - $end_reply_char = 'A'; - $reply_number = -1; - $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; - } - if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; - $row = sql_fetch($sql); + $reply_len = strlen($reply_array['wr_reply']) + 1; + if ($board['bo_reply_order']) { + $begin_reply_char = 'A'; + $end_reply_char = 'Z'; + $reply_number = +1; + $sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; + } else { + $begin_reply_char = 'Z'; + $end_reply_char = 'A'; + $reply_number = -1; + $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; + } + if ($reply_array['wr_reply']) + $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; + $row = sql_fetch($sql); - if (!$row['reply']) { - $reply_char = $begin_reply_char; - } else if ($row['reply'] == $end_reply_char) { // A~Z은 26 입니다. - alert("더 이상 답변하실 수 없습니다.\\n답변은 26개 까지만 가능합니다."); - } else { - $reply_char = chr(ord($row['reply']) + $reply_number); - } + if (!$row['reply']) { + $reply_char = $begin_reply_char; + } else if ($row['reply'] == $end_reply_char) { // A~Z은 26 입니다. + alert("더 이상 답변하실 수 없습니다.\\n답변은 26개 까지만 가능합니다."); + } else { + $reply_char = chr(ord($row['reply']) + $reply_number); + } - $reply = $reply_array['wr_reply'] . $reply_char; + $reply = $reply_array['wr_reply'] . $reply_char; } else { - alert('w 값이 제대로 넘어오지 않았습니다.'); + alert('w 값이 제대로 넘어오지 않았습니다.'); } if ($is_guest && !chk_captcha()) { - alert('자동등록방지 숫자가 틀렸습니다.'); + alert('자동등록방지 숫자가 틀렸습니다.'); } if ($w == '' || $w == 'r') { - if (isset($_SESSION['ss_datetime'])) { - if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin) - alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.'); - } + if (isset($_SESSION['ss_datetime'])) { + if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin) + alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.'); + } - set_session("ss_datetime", G5_SERVER_TIME); + set_session("ss_datetime", G5_SERVER_TIME); } if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject'])) - alert('제목을 입력하여 주십시오.'); + alert('제목을 입력하여 주십시오.'); if ($w == '' || $w == 'r') { - if ($member['mb_id']) { - $mb_id = $member['mb_id']; - $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); - $wr_password = $member['mb_password']; - $wr_email = addslashes($member['mb_email']); - $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); - } else { - $mb_id = ''; - // 비회원의 경우 이름이 누락되는 경우가 있음 - $wr_name = clean_xss_tags(trim($_POST['wr_name'])); - if (!$wr_name) - alert('이름은 필히 입력하셔야 합니다.'); - $wr_password = get_encrypt_string($wr_password); - $wr_email = get_email_address(trim($_POST['wr_email'])); - $wr_homepage = clean_xss_tags($wr_homepage); - } + if ($member['mb_id']) { + $mb_id = $member['mb_id']; + $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); + $wr_password = $member['mb_password']; + $wr_email = addslashes($member['mb_email']); + $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); + } else { + $mb_id = ''; + // 비회원의 경우 이름이 누락되는 경우가 있음 + $wr_name = clean_xss_tags(trim($_POST['wr_name'])); + if (!$wr_name) + alert('이름은 필히 입력하셔야 합니다.'); + $wr_password = get_encrypt_string($wr_password); + $wr_email = get_email_address(trim($_POST['wr_email'])); + $wr_homepage = clean_xss_tags($wr_homepage); + } - if ($w == 'r') { - // 답변의 원글이 비밀글이라면 비밀번호는 원글과 동일하게 넣는다. - if ($secret) - $wr_password = $wr['wr_password']; + if ($w == 'r') { + // 답변의 원글이 비밀글이라면 비밀번호는 원글과 동일하게 넣는다. + if ($secret) + $wr_password = $wr['wr_password']; - $wr_id = $wr_id . $reply; - $wr_num = $write['wr_num']; - $wr_reply = $reply; - } else { - $wr_num = get_next_num($write_table); - $wr_reply = ''; - } + $wr_id = $wr_id . $reply; + $wr_num = $write['wr_num']; + $wr_reply = $reply; + } else { + $wr_num = get_next_num($write_table); + $wr_reply = ''; + } - $sql = " insert into $write_table + $sql = " insert into $write_table set wr_num = '$wr_num', wr_reply = '$wr_reply', wr_comment = 0, @@ -256,8 +257,8 @@ if ($w == '' || $w == 'r') { wr_name = '$wr_name', wr_email = '$wr_email', wr_homepage = '$wr_homepage', - wr_datetime = '".G5_TIME_YMDHIS."', - wr_last = '".G5_TIME_YMDHIS."', + wr_datetime = '" . G5_TIME_YMDHIS . "', + wr_last = '" . G5_TIME_YMDHIS . "', wr_ip = '{$_SERVER['REMOTE_ADDR']}', ch_id = '{$character['ch_id']}', @@ -286,98 +287,99 @@ if ($w == '' || $w == 'r') { wr_8 = '$wr_8', wr_9 = '$wr_9', wr_10 = '$wr_10' "; - sql_query($sql); + sql_query($sql); - $wr_id = sql_insert_id(); + $wr_id = sql_insert_id(); - // 부모 아이디에 UPDATE - sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); + // 부모 아이디에 UPDATE + sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); - // 새글 INSERT - sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) "); + // 새글 INSERT + sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '" . G5_TIME_YMDHIS . "', '{$member['mb_id']}' ) "); - // 게시글 1 증가 - sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'"); + // 게시글 1 증가 + sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'"); - // 쓰기 포인트 부여 - if ($w == '') { - if ($notice) { - $bo_notice = $wr_id.($board['bo_notice'] ? ",".$board['bo_notice'] : ''); - sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); - } - - insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기'); - } else { - // 답변은 코멘트 포인트를 부여함 - // 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음 - insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기'); - } -} else if ($w == 'u') { - if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) { - //alert('올바른 방법으로 수정하여 주십시오.', G5_BBS_URL.'/board.php?bo_table='.$bo_table); + // 쓰기 포인트 부여 + if ($w == '') { + if ($notice) { + $bo_notice = $wr_id . ($board['bo_notice'] ? "," . $board['bo_notice'] : ''); + sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); } - $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id; + insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기'); + } else { + // 답변은 코멘트 포인트를 부여함 + // 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음 + insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기'); + } +} else if ($w == 'u') { + if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) { + //alert('올바른 방법으로 수정하여 주십시오.', G5_BBS_URL.'/board.php?bo_table='.$bo_table); + } - if ($is_admin == 'super') // 최고관리자 통과 - ; - else if ($is_admin == 'group') { // 그룹관리자 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가? - alert('자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.', $return_url); - else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); - } else if ($is_admin == 'board') { // 게시판관리자이면 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가? - alert('자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.', $return_url); - else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); - } else if ($member['mb_id']) { - if ($member['mb_id'] != $write['mb_id']) - alert('자신의 글이 아니므로 수정할 수 없습니다.', $return_url); - } else { - if ($write['mb_id']) - alert('로그인 후 수정하세요.', './login.php?url='.urlencode($return_url)); - } + $return_url = './board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id; - if ($member['mb_id']) { - // 자신의 글이라면 - if ($member['mb_id'] == $wr['mb_id']) { - $mb_id = $member['mb_id']; - $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); - $wr_email = addslashes($member['mb_email']); - $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); - } else { - $mb_id = $wr['mb_id']; - if(isset($_POST['wr_name']) && $_POST['wr_name']) - $wr_name = clean_xss_tags(trim($_POST['wr_name'])); - else - $wr_name = addslashes(clean_xss_tags($wr['wr_name'])); - if(isset($_POST['wr_email']) && $_POST['wr_email']) - $wr_email = get_email_address(trim($_POST['wr_email'])); - else - $wr_email = addslashes($wr['wr_email']); - if(isset($_POST['wr_homepage']) && $_POST['wr_homepage']) - $wr_homepage = addslashes(clean_xss_tags($_POST['wr_homepage'])); - else - $wr_homepage = addslashes(clean_xss_tags($wr['wr_homepage'])); - } + if ($is_admin == 'super') // 최고관리자 통과 + ; + else if ($is_admin == 'group') { // 그룹관리자 + $mb = get_member($write['mb_id']); + if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가? + alert('자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.', $return_url); + else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); + } else if ($is_admin == 'board') { // 게시판관리자이면 + $mb = get_member($write['mb_id']); + if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가? + alert('자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.', $return_url); + else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); + } else if ($member['mb_id']) { + if ($member['mb_id'] != $write['mb_id']) + alert('자신의 글이 아니므로 수정할 수 없습니다.', $return_url); + } else { + if ($write['mb_id']) + alert('로그인 후 수정하세요.', './login.php?url=' . urlencode($return_url)); + } + + if ($member['mb_id']) { + // 자신의 글이라면 + if ($member['mb_id'] == $wr['mb_id']) { + $mb_id = $member['mb_id']; + $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); + $wr_email = addslashes($member['mb_email']); + $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); } else { - $mb_id = ""; - // 비회원의 경우 이름이 누락되는 경우가 있음 - if (!trim($wr_name)) alert("이름은 필히 입력하셔야 합니다."); + $mb_id = $wr['mb_id']; + if (isset($_POST['wr_name']) && $_POST['wr_name']) $wr_name = clean_xss_tags(trim($_POST['wr_name'])); + else + $wr_name = addslashes(clean_xss_tags($wr['wr_name'])); + if (isset($_POST['wr_email']) && $_POST['wr_email']) $wr_email = get_email_address(trim($_POST['wr_email'])); + else + $wr_email = addslashes($wr['wr_email']); + if (isset($_POST['wr_homepage']) && $_POST['wr_homepage']) + $wr_homepage = addslashes(clean_xss_tags($_POST['wr_homepage'])); + else + $wr_homepage = addslashes(clean_xss_tags($wr['wr_homepage'])); } + } else { + $mb_id = ""; + // 비회원의 경우 이름이 누락되는 경우가 있음 + if (!trim($wr_name)) + alert("이름은 필히 입력하셔야 합니다."); + $wr_name = clean_xss_tags(trim($_POST['wr_name'])); + $wr_email = get_email_address(trim($_POST['wr_email'])); + } - $sql_password = $wr_password ? " , wr_password = '".get_encrypt_string($wr_password)."' " : ""; + $sql_password = $wr_password ? " , wr_password = '" . get_encrypt_string($wr_password) . "' " : ""; - $sql_ip = ''; - if (!$is_admin) - $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; + $sql_ip = ''; + if (!$is_admin) + $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; - $sql = " update {$write_table} + $sql = " update {$write_table} set ca_name = '{$ca_name}', wr_option = '{$html},{$secret},{$mail}', wr_subject = '{$wr_subject}', @@ -414,180 +416,177 @@ if ($w == '' || $w == 'r') { {$sql_ip} {$sql_password} where wr_id = '{$wr['wr_id']}' "; - sql_query($sql); + sql_query($sql); - // 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함 - // 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음 - $sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' "; - sql_query($sql); + // 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함 + // 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음 + $sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' "; + sql_query($sql); - /* - if ($notice) { - //if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice'])) - if (!in_array((int)$wr_id, $notice_array)) { - $bo_notice = $wr_id . ',' . $board['bo_notice']; - sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); - } - } else { - $bo_notice = ''; - for ($i=0; $i $board['bo_upload_count']) - alert('기존 파일을 삭제하신 후 첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.'); +if ($w == 'u') { + $file = get_file($bo_table, $wr_id); + if ($file_count && (int) $file['count'] > $board['bo_upload_count']) + alert('기존 파일을 삭제하신 후 첨부파일을 ' . number_format($board['bo_upload_count']) . '개 이하로 업로드 해주십시오.'); } else { - if($file_count > $board['bo_upload_count']) - alert('첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.'); + if ($file_count > $board['bo_upload_count']) + alert('첨부파일을 ' . number_format($board['bo_upload_count']) . '개 이하로 업로드 해주십시오.'); } // 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.) -@mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION); -@chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION); +@mkdir(G5_DATA_PATH . '/file/' . $bo_table, G5_DIR_PERMISSION); +@chmod(G5_DATA_PATH . '/file/' . $bo_table, G5_DIR_PERMISSION); -$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z')); +$chars_array = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z')); // 가변 파일 업로드 $file_upload_msg = ''; $upload = array(); -for ($i=0; $i $board['bo_upload_size']) { + $file_upload_msg .= '\"' . $filename . '\" 파일의 용량(' . number_format($filesize) . ' 바이트)이 게시판에 설정(' . number_format($board['bo_upload_size']) . ' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n'; + continue; } - if (is_uploaded_file($tmp_file)) { - // 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀 - if (!$is_admin && $filesize > $board['bo_upload_size']) { - $file_upload_msg .= '\"'.$filename.'\" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($board['bo_upload_size']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n'; - continue; - } - - //=================================================================\ - // 090714 - // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 - // 에러메세지는 출력하지 않는다. - //----------------------------------------------------------------- - $timg = @getimagesize($tmp_file); - // image type - if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || - preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) { - if ($timg['2'] < 1 || $timg['2'] > 16) - continue; - } - //================================================================= - - $upload[$i]['image'] = $timg; - - // 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정 - if ($w == 'u') { - // 존재하는 파일이 있다면 삭제합니다. - $row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); - @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']); - // 이미지파일이면 썸네일삭제 - if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) { - delete_board_thumbnail($bo_table, $row['bf_file']); - } - } - - // 프로그램 원래 파일명 - $upload[$i]['source'] = $filename; - $upload[$i]['filesize'] = $filesize; - - // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 - $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); - - shuffle($chars_array); - $shuffle = implode('', $chars_array); - - // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) - $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename); - - $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file']; - - // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. - $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]); - - // 올라간 파일의 퍼미션을 변경합니다. - chmod($dest_file, G5_FILE_PERMISSION); + //=================================================================\ + // 090714 + // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 + // 에러메세지는 출력하지 않는다. + //----------------------------------------------------------------- + $timg = @getimagesize($tmp_file); + // image type + if ( + preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || + preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) + ) { + if ($timg['2'] < 1 || $timg['2'] > 16) + continue; } + //================================================================= + + $upload[$i]['image'] = $timg; + + // 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정 + if ($w == 'u') { + // 존재하는 파일이 있다면 삭제합니다. + $row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); + @unlink(G5_DATA_PATH . '/file/' . $bo_table . '/' . $row['bf_file']); + // 이미지파일이면 썸네일삭제 + if (preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) { + delete_board_thumbnail($bo_table, $row['bf_file']); + } + } + + // 프로그램 원래 파일명 + $upload[$i]['source'] = $filename; + $upload[$i]['filesize'] = $filesize; + + // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 + $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); + + shuffle($chars_array); + $shuffle = implode('', $chars_array); + + // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) + $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])) . '_' . substr($shuffle, 0, 8) . '_' . replace_filename($filename); + + $dest_file = G5_DATA_PATH . '/file/' . $bo_table . '/' . $upload[$i]['file']; + + // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. + $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]); + + // 올라간 파일의 퍼미션을 변경합니다. + chmod($dest_file, G5_FILE_PERMISSION); + } } // 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다. -for ($i=0; $i=0; $i--) -{ - $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); +for ($i = (int) $row['max_bf_no']; $i >= 0; $i--) { + $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); - // 정보가 있다면 빠집니다. - if ($row2['bf_file']) break; + // 정보가 있다면 빠집니다. + if ($row2['bf_file']) + break; - // 그렇지 않다면 정보를 삭제합니다. - sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); + // 그렇지 않다면 정보를 삭제합니다. + sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); } // 파일의 개수를 게시물에 업데이트 한다. @@ -654,76 +649,79 @@ sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' "); // 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 비밀번호를 묻지 않기 위함 if ($secret) - set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE); + set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE); // 메일발송 사용 (수정글은 발송하지 않음) if (!($w == 'u' || $w == 'cu') && $config['cf_email_use'] && $board['bo_use_email']) { - // 관리자의 정보를 얻고 - $super_admin = get_admin('super'); - $group_admin = get_admin('group'); - $board_admin = get_admin('board'); + // 관리자의 정보를 얻고 + $super_admin = get_admin('super'); + $group_admin = get_admin('group'); + $board_admin = get_admin('board'); - $wr_subject = get_text(stripslashes($wr_subject)); + $wr_subject = get_text(stripslashes($wr_subject)); - $tmp_html = 0; - if (strstr($html, 'html1')) - $tmp_html = 1; - else if (strstr($html, 'html2')) - $tmp_html = 2; + $tmp_html = 0; + if (strstr($html, 'html1')) + $tmp_html = 1; + else if (strstr($html, 'html2')) + $tmp_html = 2; - $wr_content = conv_content(conv_unescape_nl(stripslashes($wr_content)), $tmp_html); + $wr_content = conv_content(conv_unescape_nl(stripslashes($wr_content)), $tmp_html); - $warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'코멘트', 'cu'=>'코멘트 수정' ); - $str = $warr[$w]; + $warr = array('' => '입력', 'u' => '수정', 'r' => '답변', 'c' => '코멘트', 'cu' => '코멘트 수정'); + $str = $warr[$w]; - $subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' 게시판에 '.$str.'글이 올라왔습니다.'; + $subject = '[' . $config['cf_title'] . '] ' . $board['bo_subject'] . ' 게시판에 ' . $str . '글이 올라왔습니다.'; - $link_url = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&'.$qstr; + $link_url = G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . '&' . $qstr; - include_once(G5_LIB_PATH.'/mailer.lib.php'); + include_once(G5_LIB_PATH . '/mailer.lib.php'); - ob_start(); - include_once ('./write_update_mail.php'); - $content = ob_get_contents(); - ob_end_clean(); + ob_start(); + include_once('./write_update_mail.php'); + $content = ob_get_contents(); + ob_end_clean(); - $array_email = array(); - // 게시판관리자에게 보내는 메일 - if ($config['cf_email_wr_board_admin']) $array_email[] = $board_admin['mb_email']; - // 게시판그룹관리자에게 보내는 메일 - if ($config['cf_email_wr_group_admin']) $array_email[] = $group_admin['mb_email']; - // 최고관리자에게 보내는 메일 - if ($config['cf_email_wr_super_admin']) $array_email[] = $super_admin['mb_email']; + $array_email = array(); + // 게시판관리자에게 보내는 메일 + if ($config['cf_email_wr_board_admin']) + $array_email[] = $board_admin['mb_email']; + // 게시판그룹관리자에게 보내는 메일 + if ($config['cf_email_wr_group_admin']) + $array_email[] = $group_admin['mb_email']; + // 최고관리자에게 보내는 메일 + if ($config['cf_email_wr_super_admin']) + $array_email[] = $super_admin['mb_email']; - // 원글게시자에게 보내는 메일 - if ($config['cf_email_wr_write']) { - if($w == '') - $wr['wr_email'] = $wr_email; + // 원글게시자에게 보내는 메일 + if ($config['cf_email_wr_write']) { + if ($w == '') + $wr['wr_email'] = $wr_email; - $array_email[] = $wr['wr_email']; - } + $array_email[] = $wr['wr_email']; + } - // 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면 - if (strstr($wr['wr_option'], 'mail') && $wr['wr_email']) - $array_email[] = $wr['wr_email']; + // 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면 + if (strstr($wr['wr_option'], 'mail') && $wr['wr_email']) + $array_email[] = $wr['wr_email']; - // 중복된 메일 주소는 제거 - $unique_email = array_unique($array_email); - $unique_email = array_values($unique_email); - for ($i=0; $i', $msg); if ($msg) { - alert($msg); + alert($msg); } // 090710 if (substr_count($wr_content, '&#') > 50) { - alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); - exit; + alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); + exit; } $upload_max_filesize = ini_get('upload_max_filesize'); if (empty($_POST)) { - alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n게시판관리자 또는 서버관리자에게 문의 바랍니다."); + alert("파일 또는 글내용의 크기가 서버에서 설정한 값을 넘어 오류가 발생하였습니다.\\npost_max_size=" . ini_get('post_max_size') . " , upload_max_filesize=" . $upload_max_filesize . "\\n게시판관리자 또는 서버관리자에게 문의 바랍니다."); } $notice_array = explode(",", $board['bo_notice']); if ($w == 'u' || $w == 'r') { - $wr = get_write($write_table, $wr_id); - if (!$wr['wr_id']) { - alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다."); - } + $wr = get_write($write_table, $wr_id); + if (!$wr['wr_id']) { + alert("글이 존재하지 않습니다.\\n글이 삭제되었거나 이동하였을 수 있습니다."); + } } // 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글은 사용일 경우에만 가능해야 함 if (!$is_admin && !$board['bo_use_secret'] && (stripos($_POST['html'], 'secret') !== false || stripos($_POST['secret'], 'secret') !== false || stripos($_POST['mail'], 'secret') !== false)) { - alert('비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.'); + alert('비밀글 미사용 게시판 이므로 비밀글로 등록할 수 없습니다.'); } $secret = ''; if (isset($_POST['secret']) && $_POST['secret']) { - if(preg_match('#secret#', strtolower($_POST['secret']), $matches)) - $secret = $matches[0]; + if (preg_match('#secret#', strtolower($_POST['secret']), $matches)) + $secret = $matches[0]; } // 외부에서 글을 등록할 수 있는 버그가 존재하므로 비밀글 무조건 사용일때는 관리자를 제외(공지)하고 무조건 비밀글로 등록 if (!$is_admin && $board['bo_use_secret'] == 2) { - $secret = 'secret'; + $secret = 'secret'; } $html = ''; if (isset($_POST['html']) && $_POST['html']) { - if(preg_match('#html(1|2)#', strtolower($_POST['html']), $matches)) - $html = $matches[0]; + if (preg_match('#html(1|2)#', strtolower($_POST['html']), $matches)) + $html = $matches[0]; } $mail = ''; if (isset($_POST['mail']) && $_POST['mail']) { - if(preg_match('#mail#', strtolower($_POST['mail']), $matches)) - $mail = $matches[0]; + if (preg_match('#mail#', strtolower($_POST['mail']), $matches)) + $mail = $matches[0]; } $notice = ''; if (isset($_POST['notice']) && $_POST['notice']) { - $notice = $_POST['notice']; + $notice = $_POST['notice']; } -for ($i=1; $i<=10; $i++) { - $var = "wr_$i"; - $$var = ""; - if (isset($_POST['wr_'.$i]) && settype($_POST['wr_'.$i], 'string')) { - $$var = trim($_POST['wr_'.$i]); - } +for ($i = 1; $i <= 10; $i++) { + $var = "wr_$i"; + $$var = ""; + if (isset($_POST['wr_' . $i]) && settype($_POST['wr_' . $i], 'string')) { + $$var = trim($_POST['wr_' . $i]); + } } -@include_once($board_skin_path.'/write_update.head.skin.php'); +@include_once($board_skin_path . '/write_update.head.skin.php'); if ($w == '' || $w == 'u') { - // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 - if($w =='u' && $member['mb_id'] && $wr['mb_id'] == $member['mb_id']) { - ; - } else if ($member['mb_level'] < $board['bo_write_level']) { - alert('글을 쓸 권한이 없습니다.'); - } + // 김선용 1.00 : 글쓰기 권한과 수정은 별도로 처리되어야 함 + if ($w == 'u' && $member['mb_id'] && $wr['mb_id'] == $member['mb_id']) { + ; + } else if ($member['mb_level'] < $board['bo_write_level']) { + alert('글을 쓸 권한이 없습니다.'); + } - // 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함 - if (!$is_admin && $notice) { - alert('관리자만 공지할 수 있습니다.'); - } + // 외부에서 글을 등록할 수 있는 버그가 존재하므로 공지는 관리자만 등록이 가능해야 함 + if (!$is_admin && $notice) { + alert('관리자만 공지할 수 있습니다.'); + } } else if ($w == 'r') { - if (in_array((int)$wr_id, $notice_array)) { - alert('공지에는 답변 할 수 없습니다.'); - } + if (in_array((int) $wr_id, $notice_array)) { + alert('공지에는 답변 할 수 없습니다.'); + } - if ($member['mb_level'] < $board['bo_reply_level']) { - alert('글을 답변할 권한이 없습니다.'); - } + if ($member['mb_level'] < $board['bo_reply_level']) { + alert('글을 답변할 권한이 없습니다.'); + } - // 게시글 배열 참조 - $reply_array = &$wr; + // 게시글 배열 참조 + $reply_array = &$wr; - // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. - if (strlen($reply_array['wr_reply']) == 10) { - alert("더 이상 답변하실 수 없습니다.\\n답변은 10단계 까지만 가능합니다."); - } + // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. + if (strlen($reply_array['wr_reply']) == 10) { + alert("더 이상 답변하실 수 없습니다.\\n답변은 10단계 까지만 가능합니다."); + } - $reply_len = strlen($reply_array['wr_reply']) + 1; - if ($board['bo_reply_order']) { - $begin_reply_char = 'A'; - $end_reply_char = 'Z'; - $reply_number = +1; - $sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; - } else { - $begin_reply_char = 'Z'; - $end_reply_char = 'A'; - $reply_number = -1; - $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; - } - if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; - $row = sql_fetch($sql); + $reply_len = strlen($reply_array['wr_reply']) + 1; + if ($board['bo_reply_order']) { + $begin_reply_char = 'A'; + $end_reply_char = 'Z'; + $reply_number = +1; + $sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; + } else { + $begin_reply_char = 'Z'; + $end_reply_char = 'A'; + $reply_number = -1; + $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' "; + } + if ($reply_array['wr_reply']) + $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' "; + $row = sql_fetch($sql); - if (!$row['reply']) { - $reply_char = $begin_reply_char; - } else if ($row['reply'] == $end_reply_char) { // A~Z은 26 입니다. - alert("더 이상 답변하실 수 없습니다.\\n답변은 26개 까지만 가능합니다."); - } else { - $reply_char = chr(ord($row['reply']) + $reply_number); - } + if (!$row['reply']) { + $reply_char = $begin_reply_char; + } else if ($row['reply'] == $end_reply_char) { // A~Z은 26 입니다. + alert("더 이상 답변하실 수 없습니다.\\n답변은 26개 까지만 가능합니다."); + } else { + $reply_char = chr(ord($row['reply']) + $reply_number); + } - $reply = $reply_array['wr_reply'] . $reply_char; + $reply = $reply_array['wr_reply'] . $reply_char; } else { - alert('w 값이 제대로 넘어오지 않았습니다.'); + alert('w 값이 제대로 넘어오지 않았습니다.'); } if ($is_guest && !chk_captcha()) { - alert('자동등록방지 숫자가 틀렸습니다.'); + alert('자동등록방지 숫자가 틀렸습니다.'); } if ($w == '' || $w == 'r') { - if (isset($_SESSION['ss_datetime'])) { - if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin) - alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.'); - } + if (isset($_SESSION['ss_datetime'])) { + if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin) + alert('너무 빠른 시간내에 게시물을 연속해서 올릴 수 없습니다.'); + } - set_session("ss_datetime", G5_SERVER_TIME); + set_session("ss_datetime", G5_SERVER_TIME); } if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject'])) - alert('제목을 입력하여 주십시오.'); + alert('제목을 입력하여 주십시오.'); if ($w == '' || $w == 'r') { - if ($member['mb_id']) { - $mb_id = $member['mb_id']; - $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); - $wr_password = $member['mb_password']; - $wr_email = addslashes($member['mb_email']); - $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); - } else { - $mb_id = ''; - // 비회원의 경우 이름이 누락되는 경우가 있음 - $wr_name = clean_xss_tags(trim($_POST['wr_name'])); - if (!$wr_name) - alert('이름은 필히 입력하셔야 합니다.'); - $wr_password = get_encrypt_string($wr_password); - $wr_email = get_email_address(trim($_POST['wr_email'])); - $wr_homepage = clean_xss_tags($wr_homepage); - } + if ($member['mb_id']) { + $mb_id = $member['mb_id']; + $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); + $wr_password = $member['mb_password']; + $wr_email = addslashes($member['mb_email']); + $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); + } else { + $mb_id = ''; + // 비회원의 경우 이름이 누락되는 경우가 있음 + $wr_name = clean_xss_tags(trim($_POST['wr_name'])); + if (!$wr_name) + alert('이름은 필히 입력하셔야 합니다.'); + $wr_password = get_encrypt_string($wr_password); + $wr_email = get_email_address(trim($_POST['wr_email'])); + $wr_homepage = clean_xss_tags($wr_homepage); + } - if ($w == 'r') { - // 답변의 원글이 비밀글이라면 비밀번호는 원글과 동일하게 넣는다. - if ($secret) - $wr_password = $wr['wr_password']; + if ($w == 'r') { + // 답변의 원글이 비밀글이라면 비밀번호는 원글과 동일하게 넣는다. + if ($secret) + $wr_password = $wr['wr_password']; - $wr_id = $wr_id . $reply; - $wr_num = $write['wr_num']; - $wr_reply = $reply; - } else { - $wr_num = get_next_num($write_table); - $wr_reply = ''; - } + $wr_id = $wr_id . $reply; + $wr_num = $write['wr_num']; + $wr_reply = $reply; + } else { + $wr_num = get_next_num($write_table); + $wr_reply = ''; + } - $sql = " insert into $write_table + $sql = " insert into $write_table set wr_num = '$wr_num', wr_reply = '$wr_reply', wr_comment = 0, @@ -256,8 +257,8 @@ if ($w == '' || $w == 'r') { wr_name = '$wr_name', wr_email = '$wr_email', wr_homepage = '$wr_homepage', - wr_datetime = '".G5_TIME_YMDHIS."', - wr_last = '".G5_TIME_YMDHIS."', + wr_datetime = '" . G5_TIME_YMDHIS . "', + wr_last = '" . G5_TIME_YMDHIS . "', wr_ip = '{$_SERVER['REMOTE_ADDR']}', ch_id = '{$character['ch_id']}', @@ -284,98 +285,99 @@ if ($w == '' || $w == 'r') { wr_8 = '$wr_8', wr_9 = '$wr_9', wr_10 = '$wr_10' "; - sql_query($sql); + sql_query($sql); - $wr_id = sql_insert_id(); + $wr_id = sql_insert_id(); - // 부모 아이디에 UPDATE - sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); + // 부모 아이디에 UPDATE + sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' "); - // 새글 INSERT - sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) "); + // 새글 INSERT + sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '" . G5_TIME_YMDHIS . "', '{$member['mb_id']}' ) "); - // 게시글 1 증가 - sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'"); + // 게시글 1 증가 + sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'"); - // 쓰기 포인트 부여 - if ($w == '') { - if ($notice) { - $bo_notice = $wr_id.($board['bo_notice'] ? ",".$board['bo_notice'] : ''); - sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); - } - - insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기'); - } else { - // 답변은 코멘트 포인트를 부여함 - // 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음 - insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기'); - } -} else if ($w == 'u') { - if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) { - alert('올바른 방법으로 수정하여 주십시오.', G5_BBS_URL.'/board.php?bo_table='.$bo_table); + // 쓰기 포인트 부여 + if ($w == '') { + if ($notice) { + $bo_notice = $wr_id . ($board['bo_notice'] ? "," . $board['bo_notice'] : ''); + sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); } - $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id; + insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 글쓰기", $bo_table, $wr_id, '쓰기'); + } else { + // 답변은 코멘트 포인트를 부여함 + // 답변 포인트가 많은 경우 코멘트 대신 답변을 하는 경우가 많음 + insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 글답변", $bo_table, $wr_id, '쓰기'); + } +} else if ($w == 'u') { + if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) { + alert('올바른 방법으로 수정하여 주십시오.', G5_BBS_URL . '/board.php?bo_table=' . $bo_table); + } - if ($is_admin == 'super') // 최고관리자 통과 - ; - else if ($is_admin == 'group') { // 그룹관리자 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가? - alert('자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.', $return_url); - else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); - } else if ($is_admin == 'board') { // 게시판관리자이면 - $mb = get_member($write['mb_id']); - if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가? - alert('자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.', $return_url); - else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 - alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); - } else if ($member['mb_id']) { - if ($member['mb_id'] != $write['mb_id']) - alert('자신의 글이 아니므로 수정할 수 없습니다.', $return_url); - } else { - if ($write['mb_id']) - alert('로그인 후 수정하세요.', './login.php?url='.urlencode($return_url)); - } + $return_url = './board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id; - if ($member['mb_id']) { - // 자신의 글이라면 - if ($member['mb_id'] == $wr['mb_id']) { - $mb_id = $member['mb_id']; - $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); - $wr_email = addslashes($member['mb_email']); - $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); - } else { - $mb_id = $wr['mb_id']; - if(isset($_POST['wr_name']) && $_POST['wr_name']) - $wr_name = clean_xss_tags(trim($_POST['wr_name'])); - else - $wr_name = addslashes(clean_xss_tags($wr['wr_name'])); - if(isset($_POST['wr_email']) && $_POST['wr_email']) - $wr_email = get_email_address(trim($_POST['wr_email'])); - else - $wr_email = addslashes($wr['wr_email']); - if(isset($_POST['wr_homepage']) && $_POST['wr_homepage']) - $wr_homepage = addslashes(clean_xss_tags($_POST['wr_homepage'])); - else - $wr_homepage = addslashes(clean_xss_tags($wr['wr_homepage'])); - } + if ($is_admin == 'super') // 최고관리자 통과 + ; + else if ($is_admin == 'group') { // 그룹관리자 + $mb = get_member($write['mb_id']); + if ($member['mb_id'] != $group['gr_admin']) // 자신이 관리하는 그룹인가? + alert('자신이 관리하는 그룹의 게시판이 아니므로 수정할 수 없습니다.', $return_url); + else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); + } else if ($is_admin == 'board') { // 게시판관리자이면 + $mb = get_member($write['mb_id']); + if ($member['mb_id'] != $board['bo_admin']) // 자신이 관리하는 게시판인가? + alert('자신이 관리하는 게시판이 아니므로 수정할 수 없습니다.', $return_url); + else if ($member['mb_level'] < $mb['mb_level']) // 자신의 레벨이 크거나 같다면 통과 + alert('자신의 권한보다 높은 권한의 회원이 작성한 글은 수정할 수 없습니다.', $return_url); + } else if ($member['mb_id']) { + if ($member['mb_id'] != $write['mb_id']) + alert('자신의 글이 아니므로 수정할 수 없습니다.', $return_url); + } else { + if ($write['mb_id']) + alert('로그인 후 수정하세요.', './login.php?url=' . urlencode($return_url)); + } + + if ($member['mb_id']) { + // 자신의 글이라면 + if ($member['mb_id'] == $wr['mb_id']) { + $mb_id = $member['mb_id']; + $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); + $wr_email = addslashes($member['mb_email']); + $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); } else { - $mb_id = ""; - // 비회원의 경우 이름이 누락되는 경우가 있음 - if (!trim($wr_name)) alert("이름은 필히 입력하셔야 합니다."); + $mb_id = $wr['mb_id']; + if (isset($_POST['wr_name']) && $_POST['wr_name']) $wr_name = clean_xss_tags(trim($_POST['wr_name'])); + else + $wr_name = addslashes(clean_xss_tags($wr['wr_name'])); + if (isset($_POST['wr_email']) && $_POST['wr_email']) $wr_email = get_email_address(trim($_POST['wr_email'])); + else + $wr_email = addslashes($wr['wr_email']); + if (isset($_POST['wr_homepage']) && $_POST['wr_homepage']) + $wr_homepage = addslashes(clean_xss_tags($_POST['wr_homepage'])); + else + $wr_homepage = addslashes(clean_xss_tags($wr['wr_homepage'])); } + } else { + $mb_id = ""; + // 비회원의 경우 이름이 누락되는 경우가 있음 + if (!trim($wr_name)) + alert("이름은 필히 입력하셔야 합니다."); + $wr_name = clean_xss_tags(trim($_POST['wr_name'])); + $wr_email = get_email_address(trim($_POST['wr_email'])); + } - $sql_password = $wr_password ? " , wr_password = '".get_encrypt_string($wr_password)."' " : ""; + $sql_password = $wr_password ? " , wr_password = '" . get_encrypt_string($wr_password) . "' " : ""; - $sql_ip = ''; - if (!$is_admin) - $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; + $sql_ip = ''; + if (!$is_admin) + $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; - $sql = " update {$write_table} + $sql = " update {$write_table} set ca_name = '{$ca_name}', wr_option = '{$html},{$secret},{$mail}', wr_subject = '{$wr_subject}', @@ -410,179 +412,176 @@ if ($w == '' || $w == 'r') { {$sql_ip} {$sql_password} where wr_id = '{$wr['wr_id']}' "; - sql_query($sql); + sql_query($sql); - // 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함 - // 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음 - $sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' "; - sql_query($sql); + // 분류가 수정되는 경우 해당되는 코멘트의 분류명도 모두 수정함 + // 코멘트의 분류를 수정하지 않으면 검색이 제대로 되지 않음 + $sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' "; + sql_query($sql); - /* - if ($notice) { - //if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice'])) - if (!in_array((int)$wr_id, $notice_array)) { - $bo_notice = $wr_id . ',' . $board['bo_notice']; - sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); - } - } else { - $bo_notice = ''; - for ($i=0; $i $board['bo_upload_count']) - alert('기존 파일을 삭제하신 후 첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.'); +if ($w == 'u') { + $file = get_file($bo_table, $wr_id); + if ($file_count && (int) $file['count'] > $board['bo_upload_count']) + alert('기존 파일을 삭제하신 후 첨부파일을 ' . number_format($board['bo_upload_count']) . '개 이하로 업로드 해주십시오.'); } else { - if($file_count > $board['bo_upload_count']) - alert('첨부파일을 '.number_format($board['bo_upload_count']).'개 이하로 업로드 해주십시오.'); + if ($file_count > $board['bo_upload_count']) + alert('첨부파일을 ' . number_format($board['bo_upload_count']) . '개 이하로 업로드 해주십시오.'); } // 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.) -@mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION); -@chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION); +@mkdir(G5_DATA_PATH . '/file/' . $bo_table, G5_DIR_PERMISSION); +@chmod(G5_DATA_PATH . '/file/' . $bo_table, G5_DIR_PERMISSION); -$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z')); +$chars_array = array_merge(range(0, 9), range('a', 'z'), range('A', 'Z')); // 가변 파일 업로드 $file_upload_msg = ''; $upload = array(); -for ($i=0; $i $board['bo_upload_size']) { + $file_upload_msg .= '\"' . $filename . '\" 파일의 용량(' . number_format($filesize) . ' 바이트)이 게시판에 설정(' . number_format($board['bo_upload_size']) . ' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n'; + continue; } - if (is_uploaded_file($tmp_file)) { - // 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀 - if (!$is_admin && $filesize > $board['bo_upload_size']) { - $file_upload_msg .= '\"'.$filename.'\" 파일의 용량('.number_format($filesize).' 바이트)이 게시판에 설정('.number_format($board['bo_upload_size']).' 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n'; - continue; - } - - //=================================================================\ - // 090714 - // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 - // 에러메세지는 출력하지 않는다. - //----------------------------------------------------------------- - $timg = @getimagesize($tmp_file); - // image type - if ( preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || - preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) ) { - if ($timg['2'] < 1 || $timg['2'] > 16) - continue; - } - //================================================================= - - $upload[$i]['image'] = $timg; - - // 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정 - if ($w == 'u') { - // 존재하는 파일이 있다면 삭제합니다. - $row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); - @unlink(G5_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']); - // 이미지파일이면 썸네일삭제 - if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) { - delete_board_thumbnail($bo_table, $row['bf_file']); - } - } - - // 프로그램 원래 파일명 - $upload[$i]['source'] = $filename; - $upload[$i]['filesize'] = $filesize; - - // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 - $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); - - shuffle($chars_array); - $shuffle = implode('', $chars_array); - - // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) - $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename); - - $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file']; - - // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. - $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]); - - // 올라간 파일의 퍼미션을 변경합니다. - chmod($dest_file, G5_FILE_PERMISSION); + //=================================================================\ + // 090714 + // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 + // 에러메세지는 출력하지 않는다. + //----------------------------------------------------------------- + $timg = @getimagesize($tmp_file); + // image type + if ( + preg_match("/\.({$config['cf_image_extension']})$/i", $filename) || + preg_match("/\.({$config['cf_flash_extension']})$/i", $filename) + ) { + if ($timg['2'] < 1 || $timg['2'] > 16) + continue; } + //================================================================= + + $upload[$i]['image'] = $timg; + + // 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정 + if ($w == 'u') { + // 존재하는 파일이 있다면 삭제합니다. + $row = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); + @unlink(G5_DATA_PATH . '/file/' . $bo_table . '/' . $row['bf_file']); + // 이미지파일이면 썸네일삭제 + if (preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) { + delete_board_thumbnail($bo_table, $row['bf_file']); + } + } + + // 프로그램 원래 파일명 + $upload[$i]['source'] = $filename; + $upload[$i]['filesize'] = $filesize; + + // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 + $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); + + shuffle($chars_array); + $shuffle = implode('', $chars_array); + + // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) + $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])) . '_' . substr($shuffle, 0, 8) . '_' . replace_filename($filename); + + $dest_file = G5_DATA_PATH . '/file/' . $bo_table . '/' . $upload[$i]['file']; + + // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. + $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]); + + // 올라간 파일의 퍼미션을 변경합니다. + chmod($dest_file, G5_FILE_PERMISSION); + } } // 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다. -for ($i=0; $i=0; $i--) -{ - $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); +for ($i = (int) $row['max_bf_no']; $i >= 0; $i--) { + $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); - // 정보가 있다면 빠집니다. - if ($row2['bf_file']) break; + // 정보가 있다면 빠집니다. + if ($row2['bf_file']) + break; - // 그렇지 않다면 정보를 삭제합니다. - sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); + // 그렇지 않다면 정보를 삭제합니다. + sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); } // 파일의 개수를 게시물에 업데이트 한다. @@ -649,75 +644,78 @@ sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' "); // 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 비밀번호를 묻지 않기 위함 if ($secret) - set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE); + set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE); // 메일발송 사용 (수정글은 발송하지 않음) if (!($w == 'u' || $w == 'cu') && $config['cf_email_use'] && $board['bo_use_email']) { - // 관리자의 정보를 얻고 - $super_admin = get_admin('super'); - $group_admin = get_admin('group'); - $board_admin = get_admin('board'); + // 관리자의 정보를 얻고 + $super_admin = get_admin('super'); + $group_admin = get_admin('group'); + $board_admin = get_admin('board'); - $wr_subject = get_text(stripslashes($wr_subject)); + $wr_subject = get_text(stripslashes($wr_subject)); - $tmp_html = 0; - if (strstr($html, 'html1')) - $tmp_html = 1; - else if (strstr($html, 'html2')) - $tmp_html = 2; + $tmp_html = 0; + if (strstr($html, 'html1')) + $tmp_html = 1; + else if (strstr($html, 'html2')) + $tmp_html = 2; - $wr_content = conv_content(conv_unescape_nl(stripslashes($wr_content)), $tmp_html); + $wr_content = conv_content(conv_unescape_nl(stripslashes($wr_content)), $tmp_html); - $warr = array( ''=>'입력', 'u'=>'수정', 'r'=>'답변', 'c'=>'코멘트', 'cu'=>'코멘트 수정' ); - $str = $warr[$w]; + $warr = array('' => '입력', 'u' => '수정', 'r' => '답변', 'c' => '코멘트', 'cu' => '코멘트 수정'); + $str = $warr[$w]; - $subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' 게시판에 '.$str.'글이 올라왔습니다.'; + $subject = '[' . $config['cf_title'] . '] ' . $board['bo_subject'] . ' 게시판에 ' . $str . '글이 올라왔습니다.'; - $link_url = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&'.$qstr; + $link_url = G5_BBS_URL . '/board.php?bo_table=' . $bo_table . '&wr_id=' . $wr_id . '&' . $qstr; - include_once(G5_LIB_PATH.'/mailer.lib.php'); + include_once(G5_LIB_PATH . '/mailer.lib.php'); - ob_start(); - include_once ('./write_update_mail.php'); - $content = ob_get_contents(); - ob_end_clean(); + ob_start(); + include_once('./write_update_mail.php'); + $content = ob_get_contents(); + ob_end_clean(); - $array_email = array(); - // 게시판관리자에게 보내는 메일 - if ($config['cf_email_wr_board_admin']) $array_email[] = $board_admin['mb_email']; - // 게시판그룹관리자에게 보내는 메일 - if ($config['cf_email_wr_group_admin']) $array_email[] = $group_admin['mb_email']; - // 최고관리자에게 보내는 메일 - if ($config['cf_email_wr_super_admin']) $array_email[] = $super_admin['mb_email']; + $array_email = array(); + // 게시판관리자에게 보내는 메일 + if ($config['cf_email_wr_board_admin']) + $array_email[] = $board_admin['mb_email']; + // 게시판그룹관리자에게 보내는 메일 + if ($config['cf_email_wr_group_admin']) + $array_email[] = $group_admin['mb_email']; + // 최고관리자에게 보내는 메일 + if ($config['cf_email_wr_super_admin']) + $array_email[] = $super_admin['mb_email']; - // 원글게시자에게 보내는 메일 - if ($config['cf_email_wr_write']) { - if($w == '') - $wr['wr_email'] = $wr_email; + // 원글게시자에게 보내는 메일 + if ($config['cf_email_wr_write']) { + if ($w == '') + $wr['wr_email'] = $wr_email; - $array_email[] = $wr['wr_email']; - } + $array_email[] = $wr['wr_email']; + } - // 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면 - if (strstr($wr['wr_option'], 'mail') && $wr['wr_email']) - $array_email[] = $wr['wr_email']; + // 옵션에 메일받기가 체크되어 있고, 게시자의 메일이 있다면 + if (strstr($wr['wr_option'], 'mail') && $wr['wr_email']) + $array_email[] = $wr['wr_email']; - // 중복된 메일 주소는 제거 - $unique_email = array_unique($array_email); - $unique_email = array_values($unique_email); - for ($i=0; $i + - -<?php echo $wr_subject ?> 메일 + + <?php echo $wr_subject ?> 메일 -
    +
    -

    - -

    - - 작성자 - -
    - -
    - 사이트에서 게시물 확인하기 +

    + +

    + + 작성자 + +
    + +
    + 사이트에서 + 게시물 확인하기
    -
    +
    + diff --git a/AvocadoEdition_Light/extend/_sample.config.php b/AvocadoEdition_Light/extend/_sample.config.php index 36092d9..a8ef2f8 100644 --- a/AvocadoEdition_Light/extend/_sample.config.php +++ b/AvocadoEdition_Light/extend/_sample.config.php @@ -1,8 +1,9 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/extend/community.config.php b/AvocadoEdition_Light/extend/community.config.php index 3262b39..b31f713 100644 --- a/AvocadoEdition_Light/extend/community.config.php +++ b/AvocadoEdition_Light/extend/community.config.php @@ -1,95 +1,101 @@ $categories[$i]\n"; - } + $str .= "
  • $categories[$i]
  • \n"; + } - return $str; + return $str; } // MMB LIST 이미지 가져오기 function get_mmb_image($bo_table, $wr_id) { - global $g5, $config; - $filename = $alt = ""; + global $g5, $config; + $filename = $alt = ""; - $sql = " select bf_file, bf_width, bf_height from {$g5['board_file_table']} + $sql = " select bf_file, bf_width, bf_height from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_type between '1' and '3' order by bf_no limit 0, 1 "; - $row = sql_fetch($sql); + $row = sql_fetch($sql); - if($row['bf_file']) { - $src = G5_DATA_URL.'/file/'.$bo_table."/".$row['bf_file']; - $w = $row['bf_width']; - $h = $row['bf_height']; - } else { - return false; - } + if ($row['bf_file']) { + $src = G5_DATA_URL . '/file/' . $bo_table . "/" . $row['bf_file']; + $w = $row['bf_width']; + $h = $row['bf_height']; + } else { + return false; + } - $thumb = array("src"=>$src, "width"=>$w, "height"=>$h); - return $thumb; + $thumb = array("src" => $src, "width" => $w, "height" => $h); + return $thumb; } function del_html($str) { - $str = str_replace( ">", ">",$str ); - $str = str_replace( "<", "<",$str ); - $str = str_replace( "\"", """,$str ); - $str = str_replace( "<br>","
    ",$str); //br은되게함 - return $str; + $str = str_replace(">", ">", $str); + $str = str_replace("<", "<", $str); + $str = str_replace("\"", """, $str); + $str = str_replace("<br>", "
    ", $str); //br은되게함 + return $str; } // 입력 폼 안내문 -function help($help="") +function help($help = "") { - global $g5; - $str = ''.str_replace("\n", "
    ", $help).'
    '; - return $str; + global $g5; + $str = '' . str_replace("\n", "
    ", $help) . '
    '; + return $str; } // 파일을 업로드 함 function upload_file($srcfile, $destfile, $dir) { - if ($destfile == "") return false; - // 업로드 한후 , 퍼미션을 변경함 - @move_uploaded_file($srcfile, $dir.'/'.$destfile); - @chmod($dir.'/'.$destfile, G5_FILE_PERMISSION); - return true; + if ($destfile == "") + return false; + // 업로드 한후 , 퍼미션을 변경함 + @move_uploaded_file($srcfile, $dir . '/' . $destfile); + @chmod($dir . '/' . $destfile, G5_FILE_PERMISSION); + return true; } -function check_site_auth(){ - global $g5, $config, $is_member; +function check_site_auth() +{ + global $g5, $config, $is_member; - $is_page_login = (strstr($_SERVER["REQUEST_URI"], 'login') == "") ? false : true; - - // 사이트가 비공개 설정일 시, 로그인 페이지를 제외한 모든 페이지에서 외부인 접근 시 - // 로그인 페이지로 이동 시킨다. - if(!$config['cf_open']) { - if(!$is_member && !$is_page_login) { goto_url(G5_BBS_URL.'/login.php'); } - } + $is_page_login = (strstr($_SERVER["REQUEST_URI"], 'login') == "") ? false : true; + + // 사이트가 비공개 설정일 시, 로그인 페이지를 제외한 모든 페이지에서 외부인 접근 시 + // 로그인 페이지로 이동 시킨다. + if (!$config['cf_open']) { + if (!$is_member && !$is_page_login) { + goto_url(G5_BBS_URL . '/login.php'); + } + } } @@ -97,212 +103,224 @@ function check_site_auth(){ // header("location:URL") 을 대체 function goto_url_top($url) { - $url = str_replace("&", "&", $url); - //echo ""; + $url = str_replace("&", "&", $url); + //echo ""; - if (!headers_sent()) - header('Location: '.$url); - else { - echo ''; - echo ''; - } - exit; + if (!headers_sent()) + header('Location: ' . $url); + else { + echo ''; + echo ''; + } + exit; } // 로고 정보 가져오기 -function get_logo() { - global $g5; - $logo = sql_fetch("select cs_value from {$g5['css_table']} where cs_name = 'logo'"); - return $logo['cs_value']; +function get_logo() +{ + global $g5; + $logo = sql_fetch("select cs_value from {$g5['css_table']} where cs_name = 'logo'"); + return $logo['cs_value']; } // 스타일 가져오기 -function get_style($code, $field = '*') { - global $g5; +function get_style($code, $field = '*') +{ + global $g5; - if(!$field) $field = " * "; - $result = sql_fetch("select ".$field." from {$g5['css_table']} where cs_name = '".$code."'"); - return $result; + if (!$field) + $field = " * "; + $result = sql_fetch("select " . $field . " from {$g5['css_table']} where cs_name = '" . $code . "'"); + return $result; } // 사이트 화면 디자인 가져오기 -function get_site_content($co_id) { - global $g5, $config, $is_member; +function get_site_content($co_id) +{ + global $g5, $config, $is_member; - $result = ""; - $co = sql_fetch( " select * from {$g5['content_table']} where co_id = '{$co_id}' "); + $result = ""; + $co = sql_fetch(" select * from {$g5['content_table']} where co_id = '{$co_id}' "); - $pc_str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']); - $mo_str = conv_content($co['co_mobile_content'], $co['co_html'], $co['co_tag_filter_use']); + $pc_str = conv_content($co['co_content'], $co['co_html'], $co['co_tag_filter_use']); + $mo_str = conv_content($co['co_mobile_content'], $co['co_html'], $co['co_tag_filter_use']); - // 내용 변환 진행 - $no_mem = ""; - $use_mem = ""; + // 내용 변환 진행 + $no_mem = ""; + $use_mem = ""; - if($is_member) { $no_mem = " style='display: none;' "; } - if(!$is_member) { $use_mem = " style='display: none;' "; } + if ($is_member) { + $no_mem = " style='display: none;' "; + } + if (!$is_member) { + $use_mem = " style='display: none;' "; + } - if(strstr($pc_str, "{{LOGIN}}") || strstr($mo_str, "{{LOGIN}}")) { - ob_start(); - include G5_PATH.'/templete/txt.login.php'; - $login_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{LOGIN}}") || strstr($mo_str, "{{LOGIN}}")) { + ob_start(); + include G5_PATH . '/templete/txt.login.php'; + $login_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{LOGIN}}", $login_str, $pc_str); - $mo_str = str_replace("{{LOGIN}}", $login_str, $mo_str); - } + $pc_str = str_replace("{{LOGIN}}", $login_str, $pc_str); + $mo_str = str_replace("{{LOGIN}}", $login_str, $mo_str); + } - if(strstr($pc_str, "{{LOGOUT}}") || strstr($mo_str, "{{LOGOUT}}")) { - ob_start(); - include G5_PATH.'/templete/txt.logout.php'; - $logout_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{LOGOUT}}") || strstr($mo_str, "{{LOGOUT}}")) { + ob_start(); + include G5_PATH . '/templete/txt.logout.php'; + $logout_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{LOGOUT}}", $logout_str, $pc_str); - $mo_str = str_replace("{{LOGOUT}}", $logout_str, $mo_str); - } + $pc_str = str_replace("{{LOGOUT}}", $logout_str, $pc_str); + $mo_str = str_replace("{{LOGOUT}}", $logout_str, $mo_str); + } - if(strstr($pc_str, "{{JOIN}}") || strstr($mo_str, "{{JOIN}}")) { - ob_start(); - include G5_PATH.'/templete/txt.join.php'; - $join_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{JOIN}}") || strstr($mo_str, "{{JOIN}}")) { + ob_start(); + include G5_PATH . '/templete/txt.join.php'; + $join_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{JOIN}}", $join_str, $pc_str); - $mo_str = str_replace("{{JOIN}}", $join_str, $mo_str); - } + $pc_str = str_replace("{{JOIN}}", $join_str, $pc_str); + $mo_str = str_replace("{{JOIN}}", $join_str, $mo_str); + } - if(strstr($pc_str, "{{MYPAGE}}") || strstr($mo_str, "{{MYPAGE}}")) { - ob_start(); - include G5_PATH.'/templete/txt.mypage.php'; - $mypage_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{MYPAGE}}") || strstr($mo_str, "{{MYPAGE}}")) { + ob_start(); + include G5_PATH . '/templete/txt.mypage.php'; + $mypage_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{MYPAGE}}", $mypage_str, $pc_str); - $mo_str = str_replace("{{MYPAGE}}", $mypage_str, $mo_str); - } + $pc_str = str_replace("{{MYPAGE}}", $mypage_str, $pc_str); + $mo_str = str_replace("{{MYPAGE}}", $mypage_str, $mo_str); + } - if(strstr($pc_str, "{{BGM}}") || strstr($mo_str, "{{BGM}}")) { - ob_start(); - include G5_PATH.'/templete/txt.bgm.php'; - $visual_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{BGM}}") || strstr($mo_str, "{{BGM}}")) { + ob_start(); + include G5_PATH . '/templete/txt.bgm.php'; + $visual_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{BGM}}", $visual_str, $pc_str); - $mo_str = str_replace("{{BGM}}", $visual_str, $mo_str); - } + $pc_str = str_replace("{{BGM}}", $visual_str, $pc_str); + $mo_str = str_replace("{{BGM}}", $visual_str, $mo_str); + } - if(strstr($pc_str, "{{VISUAL_SLIDE}}") || strstr($mo_str, "{{VISUAL_SLIDE}}")) { - ob_start(); - include G5_PATH.'/templete/txt.visual.php'; - $visual_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{VISUAL_SLIDE}}") || strstr($mo_str, "{{VISUAL_SLIDE}}")) { + ob_start(); + include G5_PATH . '/templete/txt.visual.php'; + $visual_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{VISUAL_SLIDE}}", $visual_str, $pc_str); - $mo_str = str_replace("{{VISUAL_SLIDE}}", $visual_str, $mo_str); - } + $pc_str = str_replace("{{VISUAL_SLIDE}}", $visual_str, $pc_str); + $mo_str = str_replace("{{VISUAL_SLIDE}}", $visual_str, $mo_str); + } - if(strstr($pc_str, "{{TWITTER}}") || strstr($mo_str, "{{TWITTER}}")) { - ob_start(); - include G5_PATH.'/templete/txt.twitter.php'; - $visual_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{TWITTER}}") || strstr($mo_str, "{{TWITTER}}")) { + ob_start(); + include G5_PATH . '/templete/txt.twitter.php'; + $visual_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{TWITTER}}", $visual_str, $pc_str); - $mo_str = str_replace("{{TWITTER}}", $visual_str, $mo_str); - } + $pc_str = str_replace("{{TWITTER}}", $visual_str, $pc_str); + $mo_str = str_replace("{{TWITTER}}", $visual_str, $mo_str); + } - if(strstr($pc_str, "{{OUTLOGIN}}") || strstr($mo_str, "{{OUTLOGIN}}")) { - ob_start(); - include G5_PATH.'/templete/txt.outlogin.php'; - $visual_str = ob_get_contents(); - ob_end_clean(); + if (strstr($pc_str, "{{OUTLOGIN}}") || strstr($mo_str, "{{OUTLOGIN}}")) { + ob_start(); + include G5_PATH . '/templete/txt.outlogin.php'; + $visual_str = ob_get_contents(); + ob_end_clean(); - $pc_str = str_replace("{{OUTLOGIN}}", $visual_str, $pc_str); - $mo_str = str_replace("{{OUTLOGIN}}", $visual_str, $mo_str); - } + $pc_str = str_replace("{{OUTLOGIN}}", $visual_str, $pc_str); + $mo_str = str_replace("{{OUTLOGIN}}", $visual_str, $mo_str); + } - if($co['co_content']) { - if($co['co_mobile_content']) { - $result .= "
    ".$pc_str."
    "; - } else { - $result .= $pc_str; - } - } - if($co['co_mobile_content']) { - $result .= "
    ".$mo_str."
    "; - } + if ($co['co_content']) { + if ($co['co_mobile_content']) { + $result .= "
    " . $pc_str . "
    "; + } else { + $result .= $pc_str; + } + } + if ($co['co_mobile_content']) { + $result .= "
    " . $mo_str . "
    "; + } - return $result; + return $result; } -function emote_ev($comment) { - global $g5; - - $emo_result = sql_query("select * from {$g5['emoticon_table']}"); - $str = $comment; +function emote_ev($comment) +{ + global $g5; - for($i=0; $row=sql_fetch_array($emo_result); $i++) { - $str = str_replace($row['me_text'], "" ,$str); - } - return $str; + $emo_result = sql_query("select * from {$g5['emoticon_table']}"); + $str = $comment; + + for ($i = 0; $row = sql_fetch_array($emo_result); $i++) { + $str = str_replace($row['me_text'], "", $str); + } + return $str; } -function have_jongsung ($chr) { - static $no_jongsung = "가갸거겨고교구규그기개걔게계과괘궈궤괴귀긔까꺄꺼껴꼬꾜꾸뀨끄끼깨꺠께꼐꽈꽤꿔꿰꾀뀌끠나냐너녀노뇨누뉴느니내냬네녜놔놰눠눼뇌뉘늬다댜더뎌도됴두듀드디대댸데뎨돠돼둬뒈되뒤듸따땨떠뗘또뚀뚜뜌뜨띠때떄떼뗴똬뙈뚸뛔뙤뛰띄라랴러려로료루류르리래럐레례롸뢔뤄뤠뢰뤼릐마먀머며모묘무뮤므미매먜메몌뫄뫠뭐뭬뫼뮈믜바뱌버벼보뵤부뷰브비배뱨베볘봐봬붜붸뵈뷔븨빠뺘뻐뼈뽀뾰뿌쀼쁘삐빼뺴뻬뼤뽜뽸뿨쀄뾔쀠쁴사샤서셔소쇼수슈스시새섀세셰솨쇄숴쉐쇠쉬싀싸쌰써쎠쏘쑈쑤쓔쓰씨쌔썌쎄쎼쏴쐐쒀쒜쐬쒸씌아야어여오요우유으이애얘에예와왜워웨외위의자쟈저져조죠주쥬즈지재쟤제졔좌좨줘줴죄쥐즤짜쨔쩌쪄쪼쬬쭈쮸쯔찌째쨰쩨쪠쫘쫴쭤쮀쬐쮜쯰차챠처쳐초쵸추츄츠치채챼체쳬촤쵀춰췌최취츼카캬커켜코쿄쿠큐크키캐컈케켸콰쾌쿼퀘쾨퀴킈타탸터텨토툐투튜트티태턔테톄톼퇘퉈퉤퇴튀틔파퍄퍼펴포표푸퓨프피패퍠페폐퐈퐤풔풰푀퓌픠하햐허혀호효후휴흐히해햬헤혜화홰훠훼회휘희2459"; - return strpos($no_jongsung, $chr) === false ? true : false; +function have_jongsung($chr) +{ + static $no_jongsung = "가갸거겨고교구규그기개걔게계과괘궈궤괴귀긔까꺄꺼껴꼬꾜꾸뀨끄끼깨꺠께꼐꽈꽤꿔꿰꾀뀌끠나냐너녀노뇨누뉴느니내냬네녜놔놰눠눼뇌뉘늬다댜더뎌도됴두듀드디대댸데뎨돠돼둬뒈되뒤듸따땨떠뗘또뚀뚜뜌뜨띠때떄떼뗴똬뙈뚸뛔뙤뛰띄라랴러려로료루류르리래럐레례롸뢔뤄뤠뢰뤼릐마먀머며모묘무뮤므미매먜메몌뫄뫠뭐뭬뫼뮈믜바뱌버벼보뵤부뷰브비배뱨베볘봐봬붜붸뵈뷔븨빠뺘뻐뼈뽀뾰뿌쀼쁘삐빼뺴뻬뼤뽜뽸뿨쀄뾔쀠쁴사샤서셔소쇼수슈스시새섀세셰솨쇄숴쉐쇠쉬싀싸쌰써쎠쏘쑈쑤쓔쓰씨쌔썌쎄쎼쏴쐐쒀쒜쐬쒸씌아야어여오요우유으이애얘에예와왜워웨외위의자쟈저져조죠주쥬즈지재쟤제졔좌좨줘줴죄쥐즤짜쨔쩌쪄쪼쬬쭈쮸쯔찌째쨰쩨쪠쫘쫴쭤쮀쬐쮜쯰차챠처쳐초쵸추츄츠치채챼체쳬촤쵀춰췌최취츼카캬커켜코쿄쿠큐크키캐컈케켸콰쾌쿼퀘쾨퀴킈타탸터텨토툐투튜트티태턔테톄톼퇘퉈퉤퇴튀틔파퍄퍼펴포표푸퓨프피패퍠페폐퐈퐤풔풰푀퓌픠하햐허혀호효후휴흐히해햬헤혜화홰훠훼회휘희2459"; + return strpos($no_jongsung, $chr) === false ? true : false; } -function j ($s, $have_jongsung) { - switch($have_jongsung) { - case "은" : - $no_jongsung = "는"; - break; - case "이" : - $no_jongsung = "가"; - break; - case "을" : - $no_jongsung = "를"; - break; - } +function j($s, $have_jongsung) +{ + switch ($have_jongsung) { + case "은": + $no_jongsung = "는"; + break; + case "이": + $no_jongsung = "가"; + break; + case "을": + $no_jongsung = "를"; + break; + } - - $last_chr = mb_substr($s, -1, 1, 'UTF-8'); - return have_jongsung($last_chr) ? - $have_jongsung : - $no_jongsung; + + $last_chr = mb_substr($s, -1, 1, 'UTF-8'); + return have_jongsung($last_chr) ? + $have_jongsung : + $no_jongsung; } -function hex2rgba($color, $opacity = false) { - $default = 'rgb(0,0,0)'; - if(empty($color)) return $default; - if ($color[0] == '#' ) { - $color = substr($color, 1); - } - if (strlen($color) == 6) { - $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); - } elseif ( strlen( $color ) == 3 ) { - $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); - } else { - return $default; - } +function hex2rgba($color, $opacity = false) +{ + $default = 'rgb(0,0,0)'; + if (empty($color)) + return $default; + if ($color[0] == '#') { + $color = substr($color, 1); + } + if (strlen($color) == 6) { + $hex = array($color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5]); + } elseif (strlen($color) == 3) { + $hex = array($color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2]); + } else { + return $default; + } - $rgb = array_map('hexdec', $hex); + $rgb = array_map('hexdec', $hex); - if($opacity){ - $opacity = (100 - $opacity) / 100; - if(abs($opacity) > 1) - $opacity = 1.0; - $output = 'rgba('.implode(",",$rgb).','.$opacity.')'; - } else { - $output = 'rgb('.implode(",",$rgb).')'; - } - return $output; + if ($opacity) { + $opacity = (100 - $opacity) / 100; + if (abs($opacity) > 1) + $opacity = 1.0; + $output = 'rgba(' . implode(",", $rgb) . ',' . $opacity . ')'; + } else { + $output = 'rgb(' . implode(",", $rgb) . ')'; + } + return $output; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/extend/mmb.lib.php b/AvocadoEdition_Light/extend/mmb.lib.php index 4b89ced..49d65e7 100644 --- a/AvocadoEdition_Light/extend/mmb.lib.php +++ b/AvocadoEdition_Light/extend/mmb.lib.php @@ -1,145 +1,146 @@ \S*<\/a>`i', - 'Link URL', - $str - ); - $str = substr($str, 1); - // 해시태그 설정 - $hash_pattern = "/\\#([0-9a-zA-Z가-힣_])([0-9a-zA-Z가-힣_]*)/"; - $str = preg_replace($hash_pattern, '#$1$2', $str); + // 일반링크 설정 + $str = preg_replace( + '`\S*<\/a>`i', + 'Link URL', + $str + ); + $str = substr($str, 1); - // 로그링크 설정 - $log_pattern = "/\\@([0-9])([0-9]*)/"; - $str = preg_replace($log_pattern, '$1$2', $str); + // 해시태그 설정 + $hash_pattern = "/\\#([0-9a-zA-Z가-힣_])([0-9a-zA-Z가-힣_]*)/"; + $str = preg_replace($hash_pattern, '#$1$2', $str); - // 콜링 설정 - $str = str_replace("[[", "", $str); - $str = str_replace("]]", "", $str); + // 로그링크 설정 + $log_pattern = "/\\@([0-9])([0-9]*)/"; + $str = preg_replace($log_pattern, '$1$2', $str); - return $str; + // 콜링 설정 + $str = str_replace("[[", "", $str); + $str = str_replace("]]", "", $str); + + return $str; } -function get_sql_search_mmb($search_ca_name, $search_field, $search_text, $search_operator='and', $single_use= '') +function get_sql_search_mmb($search_ca_name, $search_field, $search_text, $search_operator = 'and', $single_use = '') { - global $g5; + global $g5; - $str = ""; - if ($search_ca_name) - $str = " ca_name = '$search_ca_name' "; + $str = ""; + if ($search_ca_name) + $str = " ca_name = '$search_ca_name' "; - $search_text = strip_tags(($search_text)); - $search_text = trim(stripslashes($search_text)); + $search_text = strip_tags(($search_text)); + $search_text = trim(stripslashes($search_text)); - if (!$search_text) { - if ($search_ca_name) { - return $str; - } else { - return '0'; - } - } + if (!$search_text) { + if ($search_ca_name) { + return $str; + } else { + return '0'; + } + } - if ($str) - $str .= " and "; + if ($str) + $str .= " and "; - // 쿼리의 속도를 높이기 위하여 ( ) 는 최소화 한다. - $op1 = ""; + // 쿼리의 속도를 높이기 위하여 ( ) 는 최소화 한다. + $op1 = ""; - // 검색어를 구분자로 나눈다. 여기서는 공백 - $s = array(); - $s = explode(" ", $search_text); + // 검색어를 구분자로 나눈다. 여기서는 공백 + $s = array(); + $s = explode(" ", $search_text); - // 검색필드를 구분자로 나눈다. 여기서는 + - $tmp = array(); - $tmp = explode(",", trim($search_field)); - $field = explode("||", $tmp[0]); - $not_comment = ""; - if (!empty($tmp[1])) - $not_comment = $tmp[1]; + // 검색필드를 구분자로 나눈다. 여기서는 + + $tmp = array(); + $tmp = explode(",", trim($search_field)); + $field = explode("||", $tmp[0]); + $not_comment = ""; + if (!empty($tmp[1])) + $not_comment = $tmp[1]; - $str .= "("; - for ($i=0; $i \ No newline at end of file diff --git a/AvocadoEdition_Light/extend/smarteditor_upload_extend.php b/AvocadoEdition_Light/extend/smarteditor_upload_extend.php index e1c2049..c41e5c8 100644 --- a/AvocadoEdition_Light/extend/smarteditor_upload_extend.php +++ b/AvocadoEdition_Light/extend/smarteditor_upload_extend.php @@ -1,5 +1,6 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/extend/user.config.php b/AvocadoEdition_Light/extend/user.config.php index 937fcb7..222dedc 100644 --- a/AvocadoEdition_Light/extend/user.config.php +++ b/AvocadoEdition_Light/extend/user.config.php @@ -1,4 +1,3 @@ \ No newline at end of file +if (!defined('_GNUBOARD_')) + exit; // 개별 페이지 접근 불가 diff --git a/AvocadoEdition_Light/extend/version.extend.php b/AvocadoEdition_Light/extend/version.extend.php index 993eb6c..70b12c0 100644 --- a/AvocadoEdition_Light/extend/version.extend.php +++ b/AvocadoEdition_Light/extend/version.extend.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/connect.lib.php b/AvocadoEdition_Light/lib/connect.lib.php index 8bc5c78..caa66c6 100644 --- a/AvocadoEdition_Light/lib/connect.lib.php +++ b/AvocadoEdition_Light/lib/connect.lib.php @@ -1,23 +1,23 @@ '',1,0)) as mb_cnt, count(*) as total_cnt from {$g5['login_table']} where mb_id <> '{$config['cf_admin']}' "; - $row = sql_fetch($sql); + // 회원, 방문객 카운트 + $sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from {$g5['login_table']} where mb_id <> '{$config['cf_admin']}' "; + $row = sql_fetch($sql); - $connect_skin_path = G5_SKIN_PATH.'/connect/'.$skin_dir; - $connect_skin_url = G5_SKIN_URL.'/connect/'.$skin_dir; + $connect_skin_path = G5_SKIN_PATH . '/connect/' . $skin_dir; + $connect_skin_url = G5_SKIN_URL . '/connect/' . $skin_dir; - ob_start(); - include_once ($connect_skin_path.'/connect.skin.php'); - $content = ob_get_contents(); - ob_end_clean(); + ob_start(); + include_once($connect_skin_path . '/connect.skin.php'); + $content = ob_get_contents(); + ob_end_clean(); - return $content; + return $content; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/editor.lib.php b/AvocadoEdition_Light/lib/editor.lib.php index 6161098..160a095 100644 --- a/AvocadoEdition_Light/lib/editor.lib.php +++ b/AvocadoEdition_Light/lib/editor.lib.php @@ -1,5 +1,6 @@ $content"; + return ""; } // textarea 로 값을 넘긴다. javascript 반드시 필요 function get_editor_js($id) { - return "var {$id}_editor = document.getElementById('{$id}');\n"; + return "var {$id}_editor = document.getElementById('{$id}');\n"; } // textarea 의 값이 비어 있는지 검사 function chk_editor_js($id) { - return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n"; + return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n"; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/json.lib.php b/AvocadoEdition_Light/lib/json.lib.php index 37fa82b..16dbcdc 100644 --- a/AvocadoEdition_Light/lib/json.lib.php +++ b/AvocadoEdition_Light/lib/json.lib.php @@ -1,79 +1,71 @@ $v) $result[] = json_encode($k).':'.json_encode($v); - return '{' . join(',', $result) . '}'; - } +if (!function_exists('json_encode')) { + function json_encode($a = false) + { + // Some basic debugging to ensure we have something returned + if (is_null($a)) + return 'null'; + if ($a === false) + return 'false'; + if ($a === true) + return 'true'; + if (is_scalar($a)) { + if (is_float($a)) { + // Always use '.' for floats. + return floatval(str_replace(',', '.', strval($a))); + } + if (is_string($a)) { + static $jsonReplaces = array(array('\\', '/', "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"')); + return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"'; + } else + return $a; } + $isList = true; + for ($i = 0, reset($a); true; $i++) { + if (key($a) !== $i) { + $isList = false; + break; + } + } + $result = array(); + if ($isList) { + foreach ($a as $v) + $result[] = json_encode($v); + return '[' . join(',', $result) . ']'; + } else { + foreach ($a as $k => $v) + $result[] = json_encode($k) . ':' . json_encode($v); + return '{' . join(',', $result) . '}'; + } + } } -if(!function_exists('json_decode')) -{ - function json_decode($json) - { - $comment = false; - $out = '$x='; - for ($i=0; $i \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/latest.lib.php b/AvocadoEdition_Light/lib/latest.lib.php index b806420..400de1f 100644 --- a/AvocadoEdition_Light/lib/latest.lib.php +++ b/AvocadoEdition_Light/lib/latest.lib.php @@ -1,64 +1,66 @@ 0) { - $filetime = filemtime($cache_file); - if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) { - @unlink($cache_file); - $cache_fwrite = true; - } - } + if (!file_exists($cache_file)) { + $cache_fwrite = true; + } else { + if ($cache_time > 0) { + $filetime = filemtime($cache_file); + if ($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) { + @unlink($cache_file); + $cache_fwrite = true; + } + } - if(!$cache_fwrite) - include($cache_file); - } - } + if (!$cache_fwrite) + include($cache_file); + } + } - if(!G5_USE_CACHE || $cache_fwrite) { - $list = array(); + if (!G5_USE_CACHE || $cache_fwrite) { + $list = array(); - $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' "; - $board = sql_fetch($sql); - $bo_subject = get_text($board['bo_subject']); + $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' "; + $board = sql_fetch($sql); + $bo_subject = get_text($board['bo_subject']); - $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름 - $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} "; - $result = sql_query($sql); - for ($i=0; $row = sql_fetch_array($result); $i++) { - $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len); - } + $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름 + $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} "; + $result = sql_query($sql); + for ($i = 0; $row = sql_fetch_array($result); $i++) { + $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len); + } - if($cache_fwrite) { - $handle = fopen($cache_file, 'w'); - $cache_content = ""; - fwrite($handle, $cache_content); - fclose($handle); - } - } + if ($cache_fwrite) { + $handle = fopen($cache_file, 'w'); + $cache_content = ""; + fwrite($handle, $cache_content); + fclose($handle); + } + } - ob_start(); - include $latest_skin_path.'/latest.skin.php'; - $content = ob_get_contents(); - ob_end_clean(); + ob_start(); + include $latest_skin_path . '/latest.skin.php'; + $content = ob_get_contents(); + ob_end_clean(); - return $content; + return $content; } -?> diff --git a/AvocadoEdition_Light/lib/mailer.lib.php b/AvocadoEdition_Light/lib/mailer.lib.php index 8d0ff70..497b0dc 100644 --- a/AvocadoEdition_Light/lib/mailer.lib.php +++ b/AvocadoEdition_Light/lib/mailer.lib.php @@ -1,55 +1,56 @@ IsSMTP(); // telling the class to use SMTP - $mail->Host = G5_SMTP; // SMTP server - if(defined('G5_SMTP_PORT') && G5_SMTP_PORT) - $mail->Port = G5_SMTP_PORT; + $mail = new PHPMailer(); // defaults to using php "mail()" + if (defined('G5_SMTP') && G5_SMTP) { + $mail->IsSMTP(); // telling the class to use SMTP + $mail->Host = G5_SMTP; // SMTP server + if (defined('G5_SMTP_PORT') && G5_SMTP_PORT) + $mail->Port = G5_SMTP_PORT; + } + $mail->CharSet = 'UTF-8'; + $mail->From = $fmail; + $mail->FromName = $fname; + $mail->Subject = $subject; + $mail->AltBody = ""; // optional, comment out and test + $mail->msgHTML($content); + $mail->addAddress($to); + if ($cc) + $mail->addCC($cc); + if ($bcc) + $mail->addBCC($bcc); + //print_r2($file); exit; + if ($file != "") { + foreach ($file as $f) { + $mail->addAttachment($f['path'], $f['name']); } - $mail->CharSet = 'UTF-8'; - $mail->From = $fmail; - $mail->FromName = $fname; - $mail->Subject = $subject; - $mail->AltBody = ""; // optional, comment out and test - $mail->msgHTML($content); - $mail->addAddress($to); - if ($cc) - $mail->addCC($cc); - if ($bcc) - $mail->addBCC($bcc); - //print_r2($file); exit; - if ($file != "") { - foreach ($file as $f) { - $mail->addAttachment($f['path'], $f['name']); - } - } - return $mail->send(); + } + return $mail->send(); } // 파일을 첨부함 function attach_file($filename, $tmp_name) { - // 서버에 업로드 되는 파일은 확장자를 주지 않는다. (보안 취약점) - $dest_file = G5_DATA_PATH.'/tmp/'.str_replace('/', '_', $tmp_name); - move_uploaded_file($tmp_name, $dest_file); - $tmpfile = array("name" => $filename, "path" => $dest_file); - return $tmpfile; + // 서버에 업로드 되는 파일은 확장자를 주지 않는다. (보안 취약점) + $dest_file = G5_DATA_PATH . '/tmp/' . str_replace('/', '_', $tmp_name); + move_uploaded_file($tmp_name, $dest_file); + $tmpfile = array("name" => $filename, "path" => $dest_file); + return $tmpfile; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/naver_syndi.lib.php b/AvocadoEdition_Light/lib/naver_syndi.lib.php index 4ccc047..5131085 100644 --- a/AvocadoEdition_Light/lib/naver_syndi.lib.php +++ b/AvocadoEdition_Light/lib/naver_syndi.lib.php @@ -1,54 +1,57 @@ $value) { - if (!curl_setopt($ch, $option, $value)) { - return false; - } - } - return true; - } + function curl_setopt_array(&$ch, $curl_options) + { + foreach ($curl_options as $option => $value) { + if (!curl_setopt($ch, $option, $value)) { + return false; + } + } + return true; + } } // 네이버 신디케이션에 ping url 을 curl 로 전달합니다. function naver_syndi_ping($bo_table, $wr_id) { - global $config; + global $config; - $token = trim($config['cf_syndi_token']); + $token = trim($config['cf_syndi_token']); - // 토큰값이 없다면 네이버 신디케이션 사용안함 - if ($token == '') return 0; + // 토큰값이 없다면 네이버 신디케이션 사용안함 + if ($token == '') + return 0; - // 신디케이션 수집 제외게시판 - if (preg_match('#^('.$config['cf_syndi_except'].')$#', $bo_table)) return -2; + // 신디케이션 수집 제외게시판 + if (preg_match('#^(' . $config['cf_syndi_except'] . ')$#', $bo_table)) + return -2; - // curl library 가 지원되어야 합니다. - if (!function_exists('curl_init')) return -3; + // curl library 가 지원되어야 합니다. + if (!function_exists('curl_init')) + return -3; - $ping_auth_header = "Authorization: Bearer " . $token; - $ping_url = urlencode( G5_SYNDI_URL . "/ping.php?bo_table={$bo_table}&wr_id={$wr_id}" ); - $ping_client_opt = array( - CURLOPT_URL => "https://apis.naver.com/crawl/nsyndi/v2", - CURLOPT_POST => true, - CURLOPT_POSTFIELDS => "ping_url=" . $ping_url, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_CONNECTTIMEOUT => 10, - CURLOPT_TIMEOUT => 10, - CURLOPT_HTTPHEADER => array("Host: apis.naver.com", "Pragma: no-cache", "Accept: */*", $ping_auth_header) - ); + $ping_auth_header = "Authorization: Bearer " . $token; + $ping_url = urlencode(G5_SYNDI_URL . "/ping.php?bo_table={$bo_table}&wr_id={$wr_id}"); + $ping_client_opt = array( + CURLOPT_URL => "https://apis.naver.com/crawl/nsyndi/v2", + CURLOPT_POST => true, + CURLOPT_POSTFIELDS => "ping_url=" . $ping_url, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_CONNECTTIMEOUT => 10, + CURLOPT_TIMEOUT => 10, + CURLOPT_HTTPHEADER => array("Host: apis.naver.com", "Pragma: no-cache", "Accept: */*", $ping_auth_header) + ); - //print_r2($ping_client_opt); exit; - $ping = curl_init(); - curl_setopt_array($ping, $ping_client_opt); - $response = curl_exec($ping); - curl_close($ping); + //print_r2($ping_client_opt); exit; + $ping = curl_init(); + curl_setopt_array($ping, $ping_client_opt); + $response = curl_exec($ping); + curl_close($ping); - return $response; + return $response; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/outlogin.lib.php b/AvocadoEdition_Light/lib/outlogin.lib.php index 2595c4d..1bcc3f8 100644 --- a/AvocadoEdition_Light/lib/outlogin.lib.php +++ b/AvocadoEdition_Light/lib/outlogin.lib.php @@ -1,45 +1,45 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/pbkdf2.compat.php b/AvocadoEdition_Light/lib/pbkdf2.compat.php index b1e1800..f9ec4cb 100644 --- a/AvocadoEdition_Light/lib/pbkdf2.compat.php +++ b/AvocadoEdition_Light/lib/pbkdf2.compat.php @@ -1,5 +1,6 @@ = PBKDF2_COMPAT_ITERATIONS) { - return false; - } else { - return true; - } + // Get the current algorithm and iteration count. + + $params = explode(':', $hash); + if (count($params) < 4) + return true; + $algo = $params[0]; + $iterations = (int) $params[1]; + + // Compare the current hash with the best supported options. + + if (!function_exists('hash_algos') || !in_array($algo, hash_algos())) { + return false; + } elseif ($algo === strtolower(PBKDF2_COMPAT_HASH_ALGORITHM) && $iterations >= PBKDF2_COMPAT_ITERATIONS) { + return false; + } else { + return true; + } } // Compares two strings $a and $b in length-constant time. function slow_equals($a, $b) { - $diff = strlen($a) ^ strlen($b); - for($i = 0; $i < strlen($a) && $i < strlen($b); $i++) { - $diff |= ord($a[$i]) ^ ord($b[$i]); - } - return $diff === 0; + $diff = strlen($a) ^ strlen($b); + for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) { + $diff |= ord($a[$i]) ^ ord($b[$i]); + } + return $diff === 0; } // PBKDF2 key derivation function as defined by RSA's PKCS #5: https://www.ietf.org/rfc/rfc2898.txt @@ -130,53 +133,54 @@ function slow_equals($a, $b) function pbkdf2_default($algo, $password, $salt, $count, $key_length) { - // Sanity check. - - if ($count <= 0 || $key_length <= 0) { - trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR); + // Sanity check. + + if ($count <= 0 || $key_length <= 0) { + trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR); + } + + // Check if we should use the fallback function. + + if (!$algo) + return pbkdf2_fallback($password, $salt, $count, $key_length); + + // Check if the selected algorithm is available. + + $algo = strtolower($algo); + if (!function_exists('hash_algos') || !in_array($algo, hash_algos())) { + if ($algo === 'sha1') { + return pbkdf2_fallback($password, $salt, $count, $key_length); + } else { + trigger_error('PBKDF2 ERROR: Hash algorithm not supported.', E_USER_ERROR); } - - // Check if we should use the fallback function. - - if (!$algo) return pbkdf2_fallback($password, $salt, $count, $key_length); - - // Check if the selected algorithm is available. - - $algo = strtolower($algo); - if (!function_exists('hash_algos') || !in_array($algo, hash_algos())) { - if ($algo === 'sha1') { - return pbkdf2_fallback($password, $salt, $count, $key_length); - } else { - trigger_error('PBKDF2 ERROR: Hash algorithm not supported.', E_USER_ERROR); - } + } + + // Use built-in function if available. + + if (function_exists('hash_pbkdf2')) { + return hash_pbkdf2($algo, $password, $salt, $count, $key_length, true); + } + + // Count the blocks. + + $hash_length = strlen(hash($algo, '', true)); + $block_count = ceil($key_length / $hash_length); + + // Hash it! + + $output = ''; + for ($i = 1; $i <= $block_count; $i++) { + $last = $salt . pack('N', $i); // $i encoded as 4 bytes, big endian. + $last = $xorsum = hash_hmac($algo, $last, $password, true); // first iteration. + for ($j = 1; $j < $count; $j++) { // The other $count - 1 iterations. + $xorsum ^= ($last = hash_hmac($algo, $last, $password, true)); } - - // Use built-in function if available. - - if (function_exists('hash_pbkdf2')) { - return hash_pbkdf2($algo, $password, $salt, $count, $key_length, true); - } - - // Count the blocks. - - $hash_length = strlen(hash($algo, '', true)); - $block_count = ceil($key_length / $hash_length); - - // Hash it! - - $output = ''; - for ($i = 1; $i <= $block_count; $i++) { - $last = $salt . pack('N', $i); // $i encoded as 4 bytes, big endian. - $last = $xorsum = hash_hmac($algo, $last, $password, true); // first iteration. - for ($j = 1; $j < $count; $j++) { // The other $count - 1 iterations. - $xorsum ^= ($last = hash_hmac($algo, $last, $password, true)); - } - $output .= $xorsum; - } - - // Truncate and return. - - return substr($output, 0, $key_length); + $output .= $xorsum; + } + + // Truncate and return. + + return substr($output, 0, $key_length); } // Fallback function using sha1() and a pure-PHP implementation of HMAC. @@ -186,36 +190,36 @@ function pbkdf2_default($algo, $password, $salt, $count, $key_length) function pbkdf2_fallback($password, $salt, $count, $key_length) { - // Count the blocks. - - $hash_length = 20; - $block_count = ceil($key_length / $hash_length); - - // Prepare the HMAC key and padding. - - if (strlen($password) > 64) { - $password = str_pad(sha1($password, true), 64, chr(0)); - } else { - $password = str_pad($password, 64, chr(0)); + // Count the blocks. + + $hash_length = 20; + $block_count = ceil($key_length / $hash_length); + + // Prepare the HMAC key and padding. + + if (strlen($password) > 64) { + $password = str_pad(sha1($password, true), 64, chr(0)); + } else { + $password = str_pad($password, 64, chr(0)); + } + + $opad = str_repeat(chr(0x5C), 64) ^ $password; + $ipad = str_repeat(chr(0x36), 64) ^ $password; + + // Hash it! + + $output = ''; + for ($i = 1; $i <= $block_count; $i++) { + $last = $salt . pack('N', $i); + $xorsum = $last = pack('H*', sha1($opad . pack('H*', sha1($ipad . $last)))); + for ($j = 1; $j < $count; $j++) { + $last = pack('H*', sha1($opad . pack('H*', sha1($ipad . $last)))); + $xorsum ^= $last; } - - $opad = str_repeat(chr(0x5C), 64) ^ $password; - $ipad = str_repeat(chr(0x36), 64) ^ $password; - - // Hash it! - - $output = ''; - for ($i = 1; $i <= $block_count; $i++) { - $last = $salt . pack('N', $i); - $xorsum = $last = pack('H*', sha1($opad . pack('H*', sha1($ipad . $last)))); - for ($j = 1; $j < $count; $j++) { - $last = pack('H*', sha1($opad . pack('H*', sha1($ipad . $last)))); - $xorsum ^= $last; - } - $output .= $xorsum; - } - - // Truncate and return. - - return substr($output, 0, $key_length); + $output .= $xorsum; + } + + // Truncate and return. + + return substr($output, 0, $key_length); } diff --git a/AvocadoEdition_Light/lib/poll.lib.php b/AvocadoEdition_Light/lib/poll.lib.php index 245f66f..74f366f 100644 --- a/AvocadoEdition_Light/lib/poll.lib.php +++ b/AvocadoEdition_Light/lib/poll.lib.php @@ -1,30 +1,31 @@ \ No newline at end of file +?> diff --git a/AvocadoEdition_Light/lib/popular.lib.php b/AvocadoEdition_Light/lib/popular.lib.php index 4826696..14e1952 100644 --- a/AvocadoEdition_Light/lib/popular.lib.php +++ b/AvocadoEdition_Light/lib/popular.lib.php @@ -1,33 +1,34 @@ \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/register.lib.php b/AvocadoEdition_Light/lib/register.lib.php index 76b2906..5782739 100644 --- a/AvocadoEdition_Light/lib/register.lib.php +++ b/AvocadoEdition_Light/lib/register.lib.php @@ -1,185 +1,187 @@ '$reg_mb_id' "); - if ($row['cnt']) - return "이미 존재하는 닉네임입니다."; - else - return ""; + global $g5; + $row = sql_fetch(" select count(*) as cnt from {$g5['member_table']} where mb_nick = '$reg_mb_nick' and mb_id <> '$reg_mb_id' "); + if ($row['cnt']) + return "이미 존재하는 닉네임입니다."; + else + return ""; } function reserve_mb_nick($reg_mb_nick) { - global $config; - if (preg_match("/[\,]?{$reg_mb_nick}/i", $config['cf_prohibit_id'])) - return "이미 예약된 단어로 사용할 수 없는 닉네임 입니다."; - else - return ""; + global $config; + if (preg_match("/[\,]?{$reg_mb_nick}/i", $config['cf_prohibit_id'])) + return "이미 예약된 단어로 사용할 수 없는 닉네임 입니다."; + else + return ""; } function empty_mb_email($reg_mb_email) { - if (!trim($reg_mb_email)) - return "E-mail 주소를 입력해 주십시오."; - else - return ""; + if (!trim($reg_mb_email)) + return "E-mail 주소를 입력해 주십시오."; + else + return ""; } function valid_mb_email($reg_mb_email) { - if (!preg_match("/([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/", $reg_mb_email)) - return "E-mail 주소가 형식에 맞지 않습니다."; - else - return ""; + if (!preg_match("/([0-9a-zA-Z_-]+)@([0-9a-zA-Z_-]+)\.([0-9a-zA-Z_-]+)/", $reg_mb_email)) + return "E-mail 주소가 형식에 맞지 않습니다."; + else + return ""; } // 금지 메일 도메인 검사 function prohibit_mb_email($reg_mb_email) { - global $config; + global $config; - list($id, $domain) = explode("@", $reg_mb_email); - $email_domains = explode("\n", trim($config['cf_prohibit_email'])); - $email_domains = array_map('trim', $email_domains); - $email_domains = array_map('strtolower', $email_domains); - $email_domain = strtolower($domain); + list($id, $domain) = explode("@", $reg_mb_email); + $email_domains = explode("\n", trim($config['cf_prohibit_email'])); + $email_domains = array_map('trim', $email_domains); + $email_domains = array_map('strtolower', $email_domains); + $email_domain = strtolower($domain); - if (in_array($email_domain, $email_domains)) - return "$domain 메일은 사용할 수 없습니다."; + if (in_array($email_domain, $email_domains)) + return "$domain 메일은 사용할 수 없습니다."; - return ""; + return ""; } function exist_mb_email($reg_mb_email, $reg_mb_id) { - global $g5; - $row = sql_fetch(" select count(*) as cnt from `{$g5['member_table']}` where mb_email = '$reg_mb_email' and mb_id <> '$reg_mb_id' "); - if ($row['cnt']) - return "이미 사용중인 E-mail 주소입니다."; - else - return ""; + global $g5; + $row = sql_fetch(" select count(*) as cnt from `{$g5['member_table']}` where mb_email = '$reg_mb_email' and mb_id <> '$reg_mb_id' "); + if ($row['cnt']) + return "이미 사용중인 E-mail 주소입니다."; + else + return ""; } function empty_mb_name($reg_mb_name) { - if (!trim($reg_mb_name)) - return "이름을 입력해 주십시오."; - else - return ""; + if (!trim($reg_mb_name)) + return "이름을 입력해 주십시오."; + else + return ""; } function valid_mb_name($mb_name) { - if (!check_string($mb_name, G5_HANGUL)) - return "이름은 공백없이 한글만 입력 가능합니다."; - else - return ""; + if (!check_string($mb_name, G5_HANGUL)) + return "이름은 공백없이 한글만 입력 가능합니다."; + else + return ""; } function valid_mb_hp($reg_mb_hp) { - $reg_mb_hp = preg_replace("/[^0-9]/", "", $reg_mb_hp); - if(!$reg_mb_hp) - return "휴대폰번호를 입력해 주십시오."; - else { - if(preg_match("/^01[0-9]{8,9}$/", $reg_mb_hp)) - return ""; - else - return "휴대폰번호를 올바르게 입력해 주십시오."; - } + $reg_mb_hp = preg_replace("/[^0-9]/", "", $reg_mb_hp); + if (!$reg_mb_hp) + return "휴대폰번호를 입력해 주십시오."; + else { + if (preg_match("/^01[0-9]{8,9}$/", $reg_mb_hp)) + return ""; + else + return "휴대폰번호를 올바르게 입력해 주십시오."; + } } function exist_mb_hp($reg_mb_hp, $reg_mb_id) { - global $g5; + global $g5; - if (!trim($reg_mb_hp)) return ""; + if (!trim($reg_mb_hp)) + return ""; - $reg_mb_hp = hyphen_hp_number($reg_mb_hp); + $reg_mb_hp = hyphen_hp_number($reg_mb_hp); - $sql = "select count(*) as cnt from {$g5['member_table']} where mb_hp = '$reg_mb_hp' and mb_id <> '$reg_mb_id' "; - $row = sql_fetch($sql); + $sql = "select count(*) as cnt from {$g5['member_table']} where mb_hp = '$reg_mb_hp' and mb_id <> '$reg_mb_id' "; + $row = sql_fetch($sql); - if($row['cnt']) - return " 이미 사용 중인 휴대폰번호입니다. ".$reg_mb_hp; - else - return ""; + if ($row['cnt']) + return " 이미 사용 중인 휴대폰번호입니다. " . $reg_mb_hp; + else + return ""; } return; -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/thumbnail.lib.php b/AvocadoEdition_Light/lib/thumbnail.lib.php index eba26b8..abb4001 100644 --- a/AvocadoEdition_Light/lib/thumbnail.lib.php +++ b/AvocadoEdition_Light/lib/thumbnail.lib.php @@ -1,488 +1,488 @@ $src, "ori"=>$ori, "alt"=>$alt); + $thumb = array("src" => $src, "ori" => $ori, "alt" => $alt); - return $thumb; + return $thumb; } // 게시글보기 썸네일 생성 -function get_view_thumbnail($contents, $thumb_width=0) +function get_view_thumbnail($contents, $thumb_width = 0) { - global $board, $config; + global $board, $config; - if (!$thumb_width) - $thumb_width = $board['bo_image_width']; + if (!$thumb_width) + $thumb_width = $board['bo_image_width']; - // $contents 중 img 태그 추출 - $matches = get_editor_image($contents, true); - - if(empty($matches)) - return $contents; - - for($i=0; $i\'\"]+[^>\'\"]+)/i", $img, $m); - $src = $m[1]; - preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m); - $style = $m[1]; - preg_match("/width:\s*(\d+)px/", $style, $m); - $width = $m[1]; - preg_match("/height:\s*(\d+)px/", $style, $m); - $height = $m[1]; - preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img, $m); - $alt = get_text($m[1]); - - // 이미지 path 구함 - $p = parse_url($src); - if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0) - $data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']); - else - $data_path = $p['path']; - - $srcfile = G5_PATH.$data_path; - - if(is_file($srcfile)) { - $size = @getimagesize($srcfile); - if(empty($size)) - continue; - - // jpg 이면 exif 체크 - if($size[2] == 2 && function_exists('exif_read_data')) { - $degree = 0; - $exif = @exif_read_data($srcfile); - if(!empty($exif['Orientation'])) { - switch($exif['Orientation']) { - case 8: - $degree = 90; - break; - case 3: - $degree = 180; - break; - case 6: - $degree = -90; - break; - } - - // 세로사진의 경우 가로, 세로 값 바꿈 - if($degree == 90 || $degree == -90) { - $tmp = $size; - $size[0] = $tmp[1]; - $size[1] = $tmp[0]; - } - } - } - - // 원본 width가 thumb_width보다 작다면 - if($size[0] <= $thumb_width) - continue; - - // Animated GIF 체크 - $is_animated = false; - if($size[2] == 1) { - $is_animated = is_animated_gif($srcfile); - } - - // 썸네일 높이 - $thumb_height = round(($thumb_width * $size[1]) / $size[0]); - $filename = basename($srcfile); - $filepath = dirname($srcfile); - - // 썸네일 생성 - if(!$is_animated) - $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false); - else - $thumb_file = $filename; - - if(!$thumb_file) - continue; - - if ($width) { - $thumb_tag = ''.$alt.''; - } else { - $thumb_tag = ''.$alt.''; - } - - // $img_tag에 editor 경로가 있으면 원본보기 링크 추가 - $img_tag = $matches[0][$i]; - if(strpos($img_tag, G5_DATA_DIR.'/'.G5_EDITOR_DIR) && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) { - $imgurl = str_replace(G5_URL, "", $src); - $thumb_tag = ''.$thumb_tag.''; - } - - $contents = str_replace($img_tag, $thumb_tag, $contents); - } - } + // $contents 중 img 태그 추출 + $matches = get_editor_image($contents, true); + if (empty($matches)) return $contents; + + for ($i = 0; $i < count($matches[1]); $i++) { + + $img = $matches[1][$i]; + preg_match("/src=[\'\"]?([^>\'\"]+[^>\'\"]+)/i", $img, $m); + $src = $m[1]; + preg_match("/style=[\"\']?([^\"\'>]+)/i", $img, $m); + $style = $m[1]; + preg_match("/width:\s*(\d+)px/", $style, $m); + $width = $m[1]; + preg_match("/height:\s*(\d+)px/", $style, $m); + $height = $m[1]; + preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $img, $m); + $alt = get_text($m[1]); + + // 이미지 path 구함 + $p = parse_url($src); + if (strpos($p['path'], '/' . G5_DATA_DIR . '/') != 0) + $data_path = preg_replace('/^\/.*\/' . G5_DATA_DIR . '/', '/' . G5_DATA_DIR, $p['path']); + else + $data_path = $p['path']; + + $srcfile = G5_PATH . $data_path; + + if (is_file($srcfile)) { + $size = @getimagesize($srcfile); + if (empty($size)) + continue; + + // jpg 이면 exif 체크 + if ($size[2] == 2 && function_exists('exif_read_data')) { + $degree = 0; + $exif = @exif_read_data($srcfile); + if (!empty($exif['Orientation'])) { + switch ($exif['Orientation']) { + case 8: + $degree = 90; + break; + case 3: + $degree = 180; + break; + case 6: + $degree = -90; + break; + } + + // 세로사진의 경우 가로, 세로 값 바꿈 + if ($degree == 90 || $degree == -90) { + $tmp = $size; + $size[0] = $tmp[1]; + $size[1] = $tmp[0]; + } + } + } + + // 원본 width가 thumb_width보다 작다면 + if ($size[0] <= $thumb_width) + continue; + + // Animated GIF 체크 + $is_animated = false; + if ($size[2] == 1) { + $is_animated = is_animated_gif($srcfile); + } + + // 썸네일 높이 + $thumb_height = round(($thumb_width * $size[1]) / $size[0]); + $filename = basename($srcfile); + $filepath = dirname($srcfile); + + // 썸네일 생성 + if (!$is_animated) + $thumb_file = thumbnail($filename, $filepath, $filepath, $thumb_width, $thumb_height, false); + else + $thumb_file = $filename; + + if (!$thumb_file) + continue; + + if ($width) { + $thumb_tag = '' . $alt . ''; + } else { + $thumb_tag = '' . $alt . ''; + } + + // $img_tag에 editor 경로가 있으면 원본보기 링크 추가 + $img_tag = $matches[0][$i]; + if (strpos($img_tag, G5_DATA_DIR . '/' . G5_EDITOR_DIR) && preg_match("/\.({$config['cf_image_extension']})$/i", $filename)) { + $imgurl = str_replace(G5_URL, "", $src); + $thumb_tag = '' . $thumb_tag . ''; + } + + $contents = str_replace($img_tag, $thumb_tag, $contents); + } + } + + return $contents; } -function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop=false, $crop_mode='center', $is_sharpen=false, $um_value='80/0.5/3') +function thumbnail($filename, $source_path, $target_path, $thumb_width, $thumb_height, $is_create, $is_crop = false, $crop_mode = 'center', $is_sharpen = false, $um_value = '80/0.5/3') { - global $g5; + global $g5; - if(!$thumb_width && !$thumb_height) - return; + if (!$thumb_width && !$thumb_height) + return; - $source_file = "$source_path/$filename"; + $source_file = "$source_path/$filename"; - if(!is_file($source_file)) // 원본 파일이 없다면 - return; + if (!is_file($source_file)) // 원본 파일이 없다면 + return; - $size = @getimagesize($source_file); - if($size[2] < 1 || $size[2] > 3) // gif, jpg, png 에 대해서만 적용 - return; + $size = @getimagesize($source_file); + if ($size[2] < 1 || $size[2] > 3) // gif, jpg, png 에 대해서만 적용 + return; - if (!is_dir($target_path)) { - @mkdir($target_path, G5_DIR_PERMISSION); - @chmod($target_path, G5_DIR_PERMISSION); + if (!is_dir($target_path)) { + @mkdir($target_path, G5_DIR_PERMISSION); + @chmod($target_path, G5_DIR_PERMISSION); + } + + // 디렉토리가 존재하지 않거나 쓰기 권한이 없으면 썸네일 생성하지 않음 + if (!(is_dir($target_path) && is_writable($target_path))) + return ''; + + // Animated GIF는 썸네일 생성하지 않음 + if ($size[2] == 1) { + if (is_animated_gif($source_file)) + return basename($source_file); + } + + $ext = array(1 => 'gif', 2 => 'jpg', 3 => 'png'); + + $thumb_filename = preg_replace("/\.[^\.]+$/i", "", $filename); // 확장자제거 + $thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}." . $ext[$size[2]]; + + $thumb_time = @filemtime($thumb_file); + $source_time = @filemtime($source_file); + + if (file_exists($thumb_file)) { + if ($is_create == false && $source_time < $thumb_time) { + return basename($thumb_file); } + } - // 디렉토리가 존재하지 않거나 쓰기 권한이 없으면 썸네일 생성하지 않음 - if(!(is_dir($target_path) && is_writable($target_path))) - return ''; + // 원본파일의 GD 이미지 생성 + $src = null; + $degree = 0; - // Animated GIF는 썸네일 생성하지 않음 - if($size[2] == 1) { - if(is_animated_gif($source_file)) - return basename($source_file); - } + if ($size[2] == 1) { + $src = @imagecreatefromgif($source_file); + $src_transparency = @imagecolortransparent($src); + } else if ($size[2] == 2) { + $src = @imagecreatefromjpeg($source_file); - $ext = array(1 => 'gif', 2 => 'jpg', 3 => 'png'); - - $thumb_filename = preg_replace("/\.[^\.]+$/i", "", $filename); // 확장자제거 - $thumb_file = "$target_path/thumb-{$thumb_filename}_{$thumb_width}x{$thumb_height}.".$ext[$size[2]]; - - $thumb_time = @filemtime($thumb_file); - $source_time = @filemtime($source_file); - - if (file_exists($thumb_file)) { - if ($is_create == false && $source_time < $thumb_time) { - return basename($thumb_file); + if (function_exists('exif_read_data')) { + // exif 정보를 기준으로 회전각도 구함 + $exif = @exif_read_data($source_file); + if (!empty($exif['Orientation'])) { + switch ($exif['Orientation']) { + case 8: + $degree = 90; + break; + case 3: + $degree = 180; + break; + case 6: + $degree = -90; + break; } - } - // 원본파일의 GD 이미지 생성 - $src = null; - $degree = 0; + // 회전각도 있으면 이미지 회전 + if ($degree) { + $src = imagerotate($src, $degree, 0); - if ($size[2] == 1) { - $src = @imagecreatefromgif($source_file); - $src_transparency = @imagecolortransparent($src); - } else if ($size[2] == 2) { - $src = @imagecreatefromjpeg($source_file); - - if(function_exists('exif_read_data')) { - // exif 정보를 기준으로 회전각도 구함 - $exif = @exif_read_data($source_file); - if(!empty($exif['Orientation'])) { - switch($exif['Orientation']) { - case 8: - $degree = 90; - break; - case 3: - $degree = 180; - break; - case 6: - $degree = -90; - break; - } - - // 회전각도 있으면 이미지 회전 - if($degree) { - $src = imagerotate($src, $degree, 0); - - // 세로사진의 경우 가로, 세로 값 바꿈 - if($degree == 90 || $degree == -90) { - $tmp = $size; - $size[0] = $tmp[1]; - $size[1] = $tmp[0]; - } - } - } + // 세로사진의 경우 가로, 세로 값 바꿈 + if ($degree == 90 || $degree == -90) { + $tmp = $size; + $size[0] = $tmp[1]; + $size[1] = $tmp[0]; + } } - } else if ($size[2] == 3) { - $src = @imagecreatefrompng($source_file); - @imagealphablending($src, true); + } + } + } else if ($size[2] == 3) { + $src = @imagecreatefrompng($source_file); + @imagealphablending($src, true); + } else { + return; + } + + if (!$src) + return; + + $is_large = true; + // width, height 설정 + if ($thumb_width) { + if (!$thumb_height) { + $thumb_height = round(($thumb_width * $size[1]) / $size[0]); } else { - return; + if ($size[0] < $thumb_width || $size[1] < $thumb_height) + $is_large = false; } + } else { + if ($thumb_height) { + $thumb_width = round(($thumb_height * $size[0]) / $size[1]); + } + } - if(!$src) - return; + $dst_x = 0; + $dst_y = 0; + $src_x = 0; + $src_y = 0; + $dst_w = $thumb_width; + $dst_h = $thumb_height; + $src_w = $size[0]; + $src_h = $size[1]; - $is_large = true; - // width, height 설정 - if($thumb_width) { - if(!$thumb_height) { - $thumb_height = round(($thumb_width * $size[1]) / $size[0]); + $ratio = $dst_h / $dst_w; + + if ($is_large) { + // 크롭처리 + if ($is_crop) { + switch ($crop_mode) { + case 'center': + if ($size[1] / $size[0] >= $ratio) { + $src_h = round($src_w * $ratio); + $src_y = round(($size[1] - $src_h) / 2); + } else { + $src_w = round($size[1] / $ratio); + $src_x = round(($size[0] - $src_w) / 2); + } + break; + default: + if ($size[1] / $size[0] >= $ratio) { + $src_h = round($src_w * $ratio); + } else { + $src_w = round($size[1] / $ratio); + } + break; + } + + $dst = imagecreatetruecolor($dst_w, $dst_h); + + if ($size[2] == 3) { + imagealphablending($dst, false); + imagesavealpha($dst, true); + } else if ($size[2] == 1) { + $palletsize = imagecolorstotal($src); + if ($src_transparency >= 0 && $src_transparency < $palletsize) { + $transparent_color = imagecolorsforindex($src, $src_transparency); + $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); + imagefill($dst, 0, 0, $current_transparent); + imagecolortransparent($dst, $current_transparent); + } + } + } else { // 비율에 맞게 생성 + $dst = imagecreatetruecolor($dst_w, $dst_h); + $bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색 + + if ($src_w > $src_h) { + $tmp_h = round(($dst_w * $src_h) / $src_w); + $dst_y = round(($dst_h - $tmp_h) / 2); + $dst_h = $tmp_h; + } else { + $tmp_w = round(($dst_h * $src_w) / $src_h); + $dst_x = round(($dst_w - $tmp_w) / 2); + $dst_w = $tmp_w; + } + + if ($size[2] == 3) { + $bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127); + imagefill($dst, 0, 0, $bgcolor); + imagealphablending($dst, false); + imagesavealpha($dst, true); + } else if ($size[2] == 1) { + $palletsize = imagecolorstotal($src); + if ($src_transparency >= 0 && $src_transparency < $palletsize) { + $transparent_color = imagecolorsforindex($src, $src_transparency); + $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); + imagefill($dst, 0, 0, $current_transparent); + imagecolortransparent($dst, $current_transparent); } else { - if($size[0] < $thumb_width || $size[1] < $thumb_height) - $is_large = false; + imagefill($dst, 0, 0, $bgcolor); } + } else { + imagefill($dst, 0, 0, $bgcolor); + } + } + } else { + $dst = imagecreatetruecolor($dst_w, $dst_h); + $bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색 + + if ($src_w < $dst_w) { + if ($src_h >= $dst_h) { + $dst_x = round(($dst_w - $src_w) / 2); + $src_h = $dst_h; + } else { + $dst_x = round(($dst_w - $src_w) / 2); + $dst_y = round(($dst_h - $src_h) / 2); + $dst_w = $src_w; + $dst_h = $src_h; + } } else { - if($thumb_height) { - $thumb_width = round(($thumb_height * $size[0]) / $size[1]); - } + if ($src_h < $dst_h) { + $dst_y = round(($dst_h - $src_h) / 2); + $dst_h = $src_h; + $src_w = $dst_w; + } } - $dst_x = 0; - $dst_y = 0; - $src_x = 0; - $src_y = 0; - $dst_w = $thumb_width; - $dst_h = $thumb_height; - $src_w = $size[0]; - $src_h = $size[1]; - - $ratio = $dst_h / $dst_w; - - if($is_large) { - // 크롭처리 - if($is_crop) { - switch($crop_mode) - { - case 'center': - if($size[1] / $size[0] >= $ratio) { - $src_h = round($src_w * $ratio); - $src_y = round(($size[1] - $src_h) / 2); - } else { - $src_w = round($size[1] / $ratio); - $src_x = round(($size[0] - $src_w) / 2); - } - break; - default: - if($size[1] / $size[0] >= $ratio) { - $src_h = round($src_w * $ratio); - } else { - $src_w = round($size[1] / $ratio); - } - break; - } - - $dst = imagecreatetruecolor($dst_w, $dst_h); - - if($size[2] == 3) { - imagealphablending($dst, false); - imagesavealpha($dst, true); - } else if($size[2] == 1) { - $palletsize = imagecolorstotal($src); - if($src_transparency >= 0 && $src_transparency < $palletsize) { - $transparent_color = imagecolorsforindex($src, $src_transparency); - $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); - imagefill($dst, 0, 0, $current_transparent); - imagecolortransparent($dst, $current_transparent); - } - } - } else { // 비율에 맞게 생성 - $dst = imagecreatetruecolor($dst_w, $dst_h); - $bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색 - - if($src_w > $src_h) { - $tmp_h = round(($dst_w * $src_h) / $src_w); - $dst_y = round(($dst_h - $tmp_h) / 2); - $dst_h = $tmp_h; - } else { - $tmp_w = round(($dst_h * $src_w) / $src_h); - $dst_x = round(($dst_w - $tmp_w) / 2); - $dst_w = $tmp_w; - } - - if($size[2] == 3) { - $bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127); - imagefill($dst, 0, 0, $bgcolor); - imagealphablending($dst, false); - imagesavealpha($dst, true); - } else if($size[2] == 1) { - $palletsize = imagecolorstotal($src); - if($src_transparency >= 0 && $src_transparency < $palletsize) { - $transparent_color = imagecolorsforindex($src, $src_transparency); - $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); - imagefill($dst, 0, 0, $current_transparent); - imagecolortransparent($dst, $current_transparent); - } else { - imagefill($dst, 0, 0, $bgcolor); - } - } else { - imagefill($dst, 0, 0, $bgcolor); - } - } + if ($size[2] == 3) { + $bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127); + imagefill($dst, 0, 0, $bgcolor); + imagealphablending($dst, false); + imagesavealpha($dst, true); + } else if ($size[2] == 1) { + $palletsize = imagecolorstotal($src); + if ($src_transparency >= 0 && $src_transparency < $palletsize) { + $transparent_color = imagecolorsforindex($src, $src_transparency); + $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); + imagefill($dst, 0, 0, $current_transparent); + imagecolortransparent($dst, $current_transparent); + } else { + imagefill($dst, 0, 0, $bgcolor); + } } else { - $dst = imagecreatetruecolor($dst_w, $dst_h); - $bgcolor = imagecolorallocate($dst, 255, 255, 255); // 배경색 - - if($src_w < $dst_w) { - if($src_h >= $dst_h) { - $dst_x = round(($dst_w - $src_w) / 2); - $src_h = $dst_h; - } else { - $dst_x = round(($dst_w - $src_w) / 2); - $dst_y = round(($dst_h - $src_h) / 2); - $dst_w = $src_w; - $dst_h = $src_h; - } - } else { - if($src_h < $dst_h) { - $dst_y = round(($dst_h - $src_h) / 2); - $dst_h = $src_h; - $src_w = $dst_w; - } - } - - if($size[2] == 3) { - $bgcolor = imagecolorallocatealpha($dst, 0, 0, 0, 127); - imagefill($dst, 0, 0, $bgcolor); - imagealphablending($dst, false); - imagesavealpha($dst, true); - } else if($size[2] == 1) { - $palletsize = imagecolorstotal($src); - if($src_transparency >= 0 && $src_transparency < $palletsize) { - $transparent_color = imagecolorsforindex($src, $src_transparency); - $current_transparent = imagecolorallocate($dst, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']); - imagefill($dst, 0, 0, $current_transparent); - imagecolortransparent($dst, $current_transparent); - } else { - imagefill($dst, 0, 0, $bgcolor); - } - } else { - imagefill($dst, 0, 0, $bgcolor); - } + imagefill($dst, 0, 0, $bgcolor); } + } - imagecopyresampled($dst, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); + imagecopyresampled($dst, $src, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h); - // sharpen 적용 - if($is_sharpen && $is_large) { - $val = explode('/', $um_value); - UnsharpMask($dst, $val[0], $val[1], $val[2]); - } + // sharpen 적용 + if ($is_sharpen && $is_large) { + $val = explode('/', $um_value); + UnsharpMask($dst, $val[0], $val[1], $val[2]); + } - if($size[2] == 1) { - imagegif($dst, $thumb_file); - } else if($size[2] == 3) { - if(!defined('G5_THUMB_PNG_COMPRESS')) - $png_compress = 5; - else - $png_compress = G5_THUMB_PNG_COMPRESS; + if ($size[2] == 1) { + imagegif($dst, $thumb_file); + } else if ($size[2] == 3) { + if (!defined('G5_THUMB_PNG_COMPRESS')) + $png_compress = 5; + else + $png_compress = G5_THUMB_PNG_COMPRESS; - imagepng($dst, $thumb_file, $png_compress); - } else { - if(!defined('G5_THUMB_JPG_QUALITY')) - $jpg_quality = 90; - else - $jpg_quality = G5_THUMB_JPG_QUALITY; + imagepng($dst, $thumb_file, $png_compress); + } else { + if (!defined('G5_THUMB_JPG_QUALITY')) + $jpg_quality = 90; + else + $jpg_quality = G5_THUMB_JPG_QUALITY; - imagejpeg($dst, $thumb_file, $jpg_quality); - } + imagejpeg($dst, $thumb_file, $jpg_quality); + } - chmod($thumb_file, G5_FILE_PERMISSION); // 추후 삭제를 위하여 파일모드 변경 + chmod($thumb_file, G5_FILE_PERMISSION); // 추후 삭제를 위하여 파일모드 변경 - imagedestroy($src); - imagedestroy($dst); + imagedestroy($src); + imagedestroy($dst); - return basename($thumb_file); + return basename($thumb_file); } -function UnsharpMask($img, $amount, $radius, $threshold) { +function UnsharpMask($img, $amount, $radius, $threshold) +{ -/* -출처 : http://vikjavev.no/computing/ump.php -New: -- In version 2.1 (February 26 2007) Tom Bishop has done some important speed enhancements. -- From version 2 (July 17 2006) the script uses the imageconvolution function in PHP -version >= 5.1, which improves the performance considerably. + /* + 출처 : http://vikjavev.no/computing/ump.php + New: + - In version 2.1 (February 26 2007) Tom Bishop has done some important speed enhancements. + - From version 2 (July 17 2006) the script uses the imageconvolution function in PHP + version >= 5.1, which improves the performance considerably. -Unsharp masking is a traditional darkroom technique that has proven very suitable for -digital imaging. The principle of unsharp masking is to create a blurred copy of the image -and compare it to the underlying original. The difference in colour values -between the two images is greatest for the pixels near sharp edges. When this -difference is subtracted from the original image, the edges will be -accentuated. + Unsharp masking is a traditional darkroom technique that has proven very suitable for + digital imaging. The principle of unsharp masking is to create a blurred copy of the image + and compare it to the underlying original. The difference in colour values + between the two images is greatest for the pixels near sharp edges. When this + difference is subtracted from the original image, the edges will be + accentuated. -The Amount parameter simply says how much of the effect you want. 100 is 'normal'. -Radius is the radius of the blurring circle of the mask. 'Threshold' is the least -difference in colour values that is allowed between the original and the mask. In practice -this means that low-contrast areas of the picture are left unrendered whereas edges -are treated normally. This is good for pictures of e.g. skin or blue skies. + The Amount parameter simply says how much of the effect you want. 100 is 'normal'. + Radius is the radius of the blurring circle of the mask. 'Threshold' is the least + difference in colour values that is allowed between the original and the mask. In practice + this means that low-contrast areas of the picture are left unrendered whereas edges + are treated normally. This is good for pictures of e.g. skin or blue skies. -Any suggenstions for improvement of the algorithm, expecially regarding the speed -and the roundoff errors in the Gaussian blur process, are welcome. + Any suggenstions for improvement of the algorithm, expecially regarding the speed + and the roundoff errors in the Gaussian blur process, are welcome. -*/ + */ -//////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////// //// //// Unsharp Mask for PHP - version 2.1.1 //// @@ -494,152 +494,165 @@ and the roundoff errors in the Gaussian blur process, are welcome. - // $img is an image that is already created within php using - // imgcreatetruecolor. No url! $img must be a truecolor image. + // $img is an image that is already created within php using + // imgcreatetruecolor. No url! $img must be a truecolor image. - // Attempt to calibrate the parameters to Photoshop: - if ($amount > 500) $amount = 500; - $amount = $amount * 0.016; - if ($radius > 50) $radius = 50; - $radius = $radius * 2; - if ($threshold > 255) $threshold = 255; + // Attempt to calibrate the parameters to Photoshop: + if ($amount > 500) + $amount = 500; + $amount = $amount * 0.016; + if ($radius > 50) + $radius = 50; + $radius = $radius * 2; + if ($threshold > 255) + $threshold = 255; - $radius = abs(round($radius)); // Only integers make sense. - if ($radius == 0) { - return $img; imagedestroy($img); } - $w = imagesx($img); $h = imagesy($img); - $imgCanvas = imagecreatetruecolor($w, $h); - $imgBlur = imagecreatetruecolor($w, $h); + $radius = abs(round($radius)); // Only integers make sense. + if ($radius == 0) { + return $img; + imagedestroy($img); + } + $w = imagesx($img); + $h = imagesy($img); + $imgCanvas = imagecreatetruecolor($w, $h); + $imgBlur = imagecreatetruecolor($w, $h); - // Gaussian blur matrix: - // - // 1 2 1 - // 2 4 2 - // 1 2 1 - // - ////////////////////////////////////////////////// + // Gaussian blur matrix: + // + // 1 2 1 + // 2 4 2 + // 1 2 1 + // + ////////////////////////////////////////////////// - if (function_exists('imageconvolution')) { // PHP >= 5.1 - $matrix = array( - array( 1, 2, 1 ), - array( 2, 4, 2 ), - array( 1, 2, 1 ) - ); - $divisor = array_sum(array_map('array_sum', $matrix)); - $offset = 0; + if (function_exists('imageconvolution')) { // PHP >= 5.1 + $matrix = array( + array(1, 2, 1), + array(2, 4, 2), + array(1, 2, 1) + ); + $divisor = array_sum(array_map('array_sum', $matrix)); + $offset = 0; - imagecopy ($imgBlur, $img, 0, 0, 0, 0, $w, $h); - imageconvolution($imgBlur, $matrix, $divisor, $offset); - } - else { + imagecopy($imgBlur, $img, 0, 0, 0, 0, $w, $h); + imageconvolution($imgBlur, $matrix, $divisor, $offset); + } else { // Move copies of the image around one pixel at the time and merge them with weight // according to the matrix. The same matrix is simply repeated for higher radii. - for ($i = 0; $i < $radius; $i++) { - imagecopy ($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left - imagecopymerge ($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right - imagecopymerge ($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center - imagecopy ($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); + for ($i = 0; $i < $radius; $i++) { + imagecopy($imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left + imagecopymerge($imgBlur, $img, 1, 0, 0, 0, $w, $h, 50); // right + imagecopymerge($imgBlur, $img, 0, 0, 0, 0, $w, $h, 50); // center + imagecopy($imgCanvas, $imgBlur, 0, 0, 0, 0, $w, $h); - imagecopymerge ($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333 ); // up - imagecopymerge ($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down - } + imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w, $h - 1, 33.33333); // up + imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w, $h, 25); // down } + } - if($threshold>0){ - // Calculate the difference between the blurred pixels and the original - // and set the pixels - for ($x = 0; $x < $w-1; $x++) { // each row - for ($y = 0; $y < $h; $y++) { // each pixel + if ($threshold > 0) { + // Calculate the difference between the blurred pixels and the original + // and set the pixels + for ($x = 0; $x < $w - 1; $x++) { // each row + for ($y = 0; $y < $h; $y++) { // each pixel - $rgbOrig = ImageColorAt($img, $x, $y); - $rOrig = (($rgbOrig >> 16) & 0xFF); - $gOrig = (($rgbOrig >> 8) & 0xFF); - $bOrig = ($rgbOrig & 0xFF); + $rgbOrig = ImageColorAt($img, $x, $y); + $rOrig = (($rgbOrig >> 16) & 0xFF); + $gOrig = (($rgbOrig >> 8) & 0xFF); + $bOrig = ($rgbOrig & 0xFF); - $rgbBlur = ImageColorAt($imgBlur, $x, $y); + $rgbBlur = ImageColorAt($imgBlur, $x, $y); - $rBlur = (($rgbBlur >> 16) & 0xFF); - $gBlur = (($rgbBlur >> 8) & 0xFF); - $bBlur = ($rgbBlur & 0xFF); + $rBlur = (($rgbBlur >> 16) & 0xFF); + $gBlur = (($rgbBlur >> 8) & 0xFF); + $bBlur = ($rgbBlur & 0xFF); - // When the masked pixels differ less from the original - // than the threshold specifies, they are set to their original value. - $rNew = (abs($rOrig - $rBlur) >= $threshold) - ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) - : $rOrig; - $gNew = (abs($gOrig - $gBlur) >= $threshold) - ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) - : $gOrig; - $bNew = (abs($bOrig - $bBlur) >= $threshold) - ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) - : $bOrig; + // When the masked pixels differ less from the original + // than the threshold specifies, they are set to their original value. + $rNew = (abs($rOrig - $rBlur) >= $threshold) + ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) + : $rOrig; + $gNew = (abs($gOrig - $gBlur) >= $threshold) + ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) + : $gOrig; + $bNew = (abs($bOrig - $bBlur) >= $threshold) + ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) + : $bOrig; - if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) { - $pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew); - ImageSetPixel($img, $x, $y, $pixCol); - } - } + if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) { + $pixCol = ImageColorAllocate($img, $rNew, $gNew, $bNew); + ImageSetPixel($img, $x, $y, $pixCol); } + } } - else{ - for ($x = 0; $x < $w; $x++) { // each row - for ($y = 0; $y < $h; $y++) { // each pixel - $rgbOrig = ImageColorAt($img, $x, $y); - $rOrig = (($rgbOrig >> 16) & 0xFF); - $gOrig = (($rgbOrig >> 8) & 0xFF); - $bOrig = ($rgbOrig & 0xFF); + } else { + for ($x = 0; $x < $w; $x++) { // each row + for ($y = 0; $y < $h; $y++) { // each pixel + $rgbOrig = ImageColorAt($img, $x, $y); + $rOrig = (($rgbOrig >> 16) & 0xFF); + $gOrig = (($rgbOrig >> 8) & 0xFF); + $bOrig = ($rgbOrig & 0xFF); - $rgbBlur = ImageColorAt($imgBlur, $x, $y); + $rgbBlur = ImageColorAt($imgBlur, $x, $y); - $rBlur = (($rgbBlur >> 16) & 0xFF); - $gBlur = (($rgbBlur >> 8) & 0xFF); - $bBlur = ($rgbBlur & 0xFF); + $rBlur = (($rgbBlur >> 16) & 0xFF); + $gBlur = (($rgbBlur >> 8) & 0xFF); + $bBlur = ($rgbBlur & 0xFF); - $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; - if($rNew>255){$rNew=255;} - elseif($rNew<0){$rNew=0;} - $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; - if($gNew>255){$gNew=255;} - elseif($gNew<0){$gNew=0;} - $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; - if($bNew>255){$bNew=255;} - elseif($bNew<0){$bNew=0;} - $rgbNew = ($rNew << 16) + ($gNew <<8) + $bNew; - ImageSetPixel($img, $x, $y, $rgbNew); - } + $rNew = ($amount * ($rOrig - $rBlur)) + $rOrig; + if ($rNew > 255) { + $rNew = 255; + } elseif ($rNew < 0) { + $rNew = 0; } + $gNew = ($amount * ($gOrig - $gBlur)) + $gOrig; + if ($gNew > 255) { + $gNew = 255; + } elseif ($gNew < 0) { + $gNew = 0; + } + $bNew = ($amount * ($bOrig - $bBlur)) + $bOrig; + if ($bNew > 255) { + $bNew = 255; + } elseif ($bNew < 0) { + $bNew = 0; + } + $rgbNew = ($rNew << 16) + ($gNew << 8) + $bNew; + ImageSetPixel($img, $x, $y, $rgbNew); + } } - imagedestroy($imgCanvas); - imagedestroy($imgBlur); + } + imagedestroy($imgCanvas); + imagedestroy($imgBlur); - return true; + return true; } -function is_animated_gif($filename) { - if(!($fh = @fopen($filename, 'rb'))) - return false; - $count = 0; - // 출처 : http://www.php.net/manual/en/function.imagecreatefromgif.php#104473 - // an animated gif contains multiple "frames", with each frame having a - // header made up of: - // * a static 4-byte sequence (\x00\x21\xF9\x04) - // * 4 variable bytes - // * a static 2-byte sequence (\x00\x2C) (some variants may use \x00\x21 ?) +function is_animated_gif($filename) +{ + if (!($fh = @fopen($filename, 'rb'))) + return false; + $count = 0; + // 출처 : http://www.php.net/manual/en/function.imagecreatefromgif.php#104473 + // an animated gif contains multiple "frames", with each frame having a + // header made up of: + // * a static 4-byte sequence (\x00\x21\xF9\x04) + // * 4 variable bytes + // * a static 2-byte sequence (\x00\x2C) (some variants may use \x00\x21 ?) - // We read through the file til we reach the end of the file, or we've found - // at least 2 frame headers - while(!feof($fh) && $count < 2) { - $chunk = fread($fh, 1024 * 100); //read 100kb at a time - $count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00(\x2C|\x21)#s', $chunk, $matches); - } + // We read through the file til we reach the end of the file, or we've found + // at least 2 frame headers + while (!feof($fh) && $count < 2) { + $chunk = fread($fh, 1024 * 100); //read 100kb at a time + $count += preg_match_all('#\x00\x21\xF9\x04.{4}\x00(\x2C|\x21)#s', $chunk, $matches); + } - fclose($fh); - return $count > 1; + fclose($fh); + return $count > 1; } -?> \ No newline at end of file diff --git a/AvocadoEdition_Light/lib/visit.lib.php b/AvocadoEdition_Light/lib/visit.lib.php index a37bf4f..6551b73 100644 --- a/AvocadoEdition_Light/lib/visit.lib.php +++ b/AvocadoEdition_Light/lib/visit.lib.php @@ -79,4 +79,3 @@ function get_os($agent) return $s; } -?> \ No newline at end of file