임시 저장된 글 기능 추가

This commit is contained in:
gnuboard
2013-07-04 17:25:18 +09:00
parent 6d3137d847
commit a7b317f6c3
6 changed files with 82 additions and 5 deletions

24
bbs/ajax.autosave.php Normal file
View File

@ -0,0 +1,24 @@
<?php
include_once('./_common.php');
if (!$is_member) die('0');
$uid = escape_trim($_REQUEST['uid']);
$subject = escape_trim($_REQUEST['subject']);
$content = escape_trim($_REQUEST['content']);
/*
$uid = get_session("ss_autosave_uid");
if (!$uid) {
$uid = get_uniqid();
set_session("ss_autosave_uid", $uid);
}
*/
if ($content) {
$sql = " insert into {$g4['autosave_table']} set mb_id = '{$member['mb_id']}', as_uid = '{$uid}', as_subject = '$subject', as_content = '$content', as_datetime = '".G4_TIME_YMDHIS."' on duplicate key update as_subject = '$subject', as_content = '$content', as_datetime = '".G4_TIME_YMDHIS."' ";
$result = sql_query($sql, false);
echo autosave_count($member['mb_id']);
}
?>

View File

@ -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');

View File

@ -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}' ");
//------------------------------------------------------------------------------
// 비밀글이라면 세션에 비밀글의 아이디를 저장한다. 자신의 글은 다시 패스워드를 묻지 않기 위함