*/
if (!defined("_GNUBOARD_")) {
    exit;
}
// 개별 페이지 접근 불가
if ($mw_basic[cf_contents_shop_write] && $w == "") {
    mw_buy_contents2($member[mb_id], $mw_basic[cf_contents_shop_write_cash], "{$board['bo_subject']} 게시물 작성", $bo_table, $wr_id);
    $write_run_time = mw_time_log($write_run_time, "[write-tail] mw_buy_contents2");
}
//if (function_exists('mw_moa_insert') && !$wr_anonymous && $mw_basic[cf_attribute] != 'anonymous') {
if (function_exists('mw_moa_insert')) {
    mw_moa_insert($write[wr_id], $wr_id, $write[mb_id], $member[mb_id]);
    $write_run_time = mw_time_log($write_run_time, "[write-tail] mw_moa_insert");
}
if (function_exists('mw_lucky_writing') && $w == '') {
    mw_lucky_writing($bo_table, $wr_id);
    $write_run_time = mw_time_log($write_run_time, "[write-tail] mw_lucky_writing");
}
sql_query(" delete from {$mw['temp_table']} where bo_table = '{$bo_table}' and mb_id = '{$member['mb_id']}' ", false);
$write_run_time = mw_time_log($write_run_time, "[write-tail] delete temp");
if ($mw_basic[cf_content_align] && $wr_align) {
    sql_query(" update {$write_table} set wr_align = '{$wr_align}' where wr_id = '{$wr_id}' ");
    $write_run_time = mw_time_log($write_run_time, "[write-tail] update wr_align");
}
if ($is_admin && $contents_shop_id && $mw_basic[cf_contents_shop]) {
    $tmp = sql_fetch("select * from {$g4['member_table']} where mb_id = '{$contents_shop_id}'");
    if ($tmp) {
        sql_query("update {$write_table} set mb_id = '{$contents_shop_id}' where wr_id = '{$wr_id}'");
    }
    $write_run_time = mw_time_log($write_run_time, "[write-tail] update contentes_shop_id");
}
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
if (!defined("_GNUBOARD_")) {
    exit;
}
// 개별 페이지 접근 불가
//if (function_exists('mw_moa_insert') && !$wr_anonymous && $mw_basic[cf_attribute] != 'anonymous') {
if (function_exists('mw_moa_insert')) {
    mw_moa_insert($wr_id, $comment_id, $write[mb_id], $member[mb_id]);
}
if (function_exists('mw_lucky_writing') && $w == 'c') {
    mw_lucky_writing($bo_table, $comment_id);
}
if ($mw_basic[cf_comment_file]) {
    //------------------------------------------------------------------------------
    // 가변 파일 업로드
    // 나중에 테이블에 저장하는 이유는 $comment_id 값을 저장해야 하기 때문입니다.
    $i = 0;
    $row = sql_fetch(" select count(*) as cnt from {$mw['comment_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$comment_id}' and bf_no = '{$i}' ");
    if ($row[cnt]) {
        // 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다.
        // 그렇지 않다면 내용만 업데이트 합니다.
        if ($upload[del_check] || $upload[file]) {
            $sql = " update {$mw['comment_file_table']}\n                        set bf_source = '{$upload[source]}',\n                            bf_file = '{$upload[file]}',\n                            bf_content = '{$bf_content}',\n                            bf_filesize = '{$upload[filesize]}',\n                            bf_width = '{$upload[image][0]}',\n                            bf_height = '{$upload[image][1]}',\n                            bf_type = '{$upload[image][2]}',\n                            bf_datetime = '{$g4['time_ymdhis']}'\n                      where bo_table = '{$bo_table}'\n                        and wr_id = '{$comment_id}'\n                        and bf_no = '{$i}' ";
            sql_query($sql);
        } else {
            $sql = " update {$mw['comment_file_table']}\n                        set bf_content = '{$bf_content}' \n                      where bo_table = '{$bo_table}'\n                        and wr_id = '{$comment_id}'\n                        and bf_no = '{$i}' ";