diff --git a/bbs/ajax.autosave.php b/bbs/ajax.autosave.php new file mode 100644 index 000000000..635d962a5 --- /dev/null +++ b/bbs/ajax.autosave.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/bbs/write.php b/bbs/write.php index dfc2009a4..e6ac6970c 100644 --- a/bbs/write.php +++ b/bbs/write.php @@ -380,6 +380,9 @@ if (!G4_IS_MOBILE && $board['bo_use_dhtml_editor'] && $member['mb_level'] >= $bo } $editor_html = editor_html('wr_content', $content, $is_dhtml_editor); +// 임시 저장된 글 갯수 +$autosave_count = autosave_count($member['mb_id']); + include_once(G4_PATH.'/head.sub.php'); @include_once ($board_skin_path.'/write.head.skin.php'); include_once('./board_head.php'); diff --git a/bbs/write_update.php b/bbs/write_update.php index 1de8a0532..a73b938f6 100644 --- a/bbs/write_update.php +++ b/bbs/write_update.php @@ -555,6 +555,9 @@ for ($i=(int)$row['max_bf_no']; $i>=0; $i--) // 파일의 갯수를 게시물에 업데이트 한다. $row = sql_fetch(" select count(*) as cnt from {$g4['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 g4s_autosave where as_uid = '{$uid}' "); //------------------------------------------------------------------------------ // 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 패스워드를 묻지 않기 위함 diff --git a/lib/common.lib.php b/lib/common.lib.php index 130234136..a9885c465 100644 --- a/lib/common.lib.php +++ b/lib/common.lib.php @@ -1722,7 +1722,7 @@ function get_uniqid() // 년월일시분초에 100분의 1초 두자리를 추가함 (1/100 초 앞에 자리가 모자르면 0으로 채움) $key = date('ymdHis', time()) . str_pad((int)(microtime()*100), 2, "0", STR_PAD_LEFT); - $result = sql_query(" insert into {$g4['uniqid_table']} values ('$key') ", false); + $result = sql_query(" insert into {$g4['uniqid_table']} set uq_id = '$key', uq_ip = '{$_SERVER['REMOTE_ADDR']}' ", false); if ($result) break; // 쿼리가 정상이면 빠진다. // insert 하지 못했으면 일정시간 쉰다음 다시 유일키를 만든다. @@ -2078,4 +2078,18 @@ function googl_short_url($longUrl) return $json->id; } + + +// 임시 저장된 글 갯수 +function autosave_count($mb_id) +{ + global $g4; + + if ($mb_id) { + $row = sql_fetch(" select count(*) as cnt from {$g4['autosave_table']} where mb_id = '$mb_id' "); + return (int)$row['cnt']; + } else { + return 0; + } +} ?> \ No newline at end of file diff --git a/plugin/ckeditor/ckeditor.lib.php b/plugin/ckeditor/ckeditor.lib.php index ed4cf6013..1e7e1a12f 100644 --- a/plugin/ckeditor/ckeditor.lib.php +++ b/plugin/ckeditor/ckeditor.lib.php @@ -57,7 +57,7 @@ function get_editor_js($id, $ckeditor=true) function chk_editor_js($id, $ckeditor=true, $textarea_name="내용을") { if ( $ckeditor ) { - return "if (!{$id}_editor_data) { alert(\"$textarea_name 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\n"; + return "if (!{$id}_editor_data) { alert(\"$textarea_name 입력해 주십시오.\"); CKEDITOR.instances.{$id}.focus(); return false; }\nif (typeof(f.wr_content)!=\"undefined\") f.wr_content.value = {$id}_editor_data;\n"; } else { return "if (!{$id}_editor.value) { alert(\"$textarea_name 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n"; } diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index cec6ba51b..1b827bac4 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -7,7 +7,8 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
-