From a7b317f6c3c1a32971e8a4760d342eda87641626 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Thu, 4 Jul 2013 17:25:18 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EB=90=9C=20=EA=B8=80=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/ajax.autosave.php | 24 ++++++++++++++++++++ bbs/write.php | 3 +++ bbs/write_update.php | 3 +++ lib/common.lib.php | 16 ++++++++++++- plugin/ckeditor/ckeditor.lib.php | 2 +- skin/board/basic/write.skin.php | 39 +++++++++++++++++++++++++++++--- 6 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 bbs/ajax.autosave.php 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; // 개별 페이지 접근 불가

-
+ + @@ -102,7 +103,12 @@ echo $option_hidden; - + + + + 임시 저장된 글 () + + @@ -211,4 +217,31 @@ function fwrite_submit(f) return true; } - \ No newline at end of file + + + \ No newline at end of file From 6f3c3ff4ebd11402a929fcaaaa08c6a163df7b99 Mon Sep 17 00:00:00 2001 From: whitedot Date: Thu, 4 Jul 2013 18:24:29 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90:=20=EC=9E=84?= =?UTF-8?q?=EC=8B=9C=EC=A0=80=EC=9E=A5=20=EB=A7=88=ED=81=AC=EC=97=85=20?= =?UTF-8?q?=EB=B0=8F=20=EC=8A=A4=ED=83=80=EC=9D=BC=201=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skin/board/basic/img/btn_close.gif | Bin 0 -> 211 bytes skin/board/basic/style.css | 11 +++++++++++ skin/board/basic/write.skin.php | 25 +++++++++++++++++++++---- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 skin/board/basic/img/btn_close.gif diff --git a/skin/board/basic/img/btn_close.gif b/skin/board/basic/img/btn_close.gif new file mode 100644 index 0000000000000000000000000000000000000000..040b180ac6584ae612ef2886487110f0ad079963 GIT binary patch literal 211 zcmZ?wbhEHbC>lw|Nj2|^XJd+Ki|K7yLIc<@85r}UAy+@_wT|Ns9P2m!^PEMO%%AQEIJ18abSL2rs@7wgh> zI-xzeYYr882T$7a>~-(!J@=MOy}Z$ltNl`73Cq0Bi3wIGB-b=ECVhGFY*&ANIg94( d^Unm859R4|2rw-)wA%9i`(c-qSMQw}tN}eeW+eas literal 0 HcmV?d00001 diff --git a/skin/board/basic/style.css b/skin/board/basic/style.css index 7047ecb95..60927815f 100644 --- a/skin/board/basic/style.css +++ b/skin/board/basic/style.css @@ -33,6 +33,17 @@ #bo_sch {margin-bottom:10px;padding-top:5px;text-align:center} #bo_sch legend {position:absolute;margin:0;padding:0;font-size:0;line-height:0;text-indent:-9999em;overflow:hidden} +/* 게시판 쓰기 */ +#autosave_wrapper {position:relative} +#autosave_pop {z-index:10;position:absolute;top:24px;right:117px;padding:8px;width:300px;border:1px solid #565656;background:#fff} +#autosave_pop div {text-align:right} +#autosave_pop button {margin:0;padding:0;border:0;background:transparent} +#autosave_pop ul {margin:10px 0;padding:0;border-top:1px solid #e9e9e9;list-style:none} +#autosave_pop li {padding:8px 5px;border-bottom:1px solid #e9e9e9;zoom:1} +#autosave_pop li:after {display:block;visibility:hidden;clear:both;content:""} +#autosave_pop a {display:block;float:left} +#autosave_pop span {display:block;float:right} + /* 게시판 읽기 */ #bo_v {margin-bottom:20px;padding-bottom:20px} diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index 1b827bac4..0ffa3e0c9 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -104,10 +104,27 @@ echo $option_hidden; - - - 임시 저장된 글 () - +
+ + + + + +
+ 임시 저장된 글 목록 +
+ +
+
+
From f5ccad3aec3cb6d501ef178b00f8a79f6a9fa371 Mon Sep 17 00:00:00 2001 From: whitedot Date: Fri, 5 Jul 2013 09:57:02 +0900 Subject: [PATCH 03/11] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90:=20=EC=9E=84?= =?UTF-8?q?=EC=8B=9C=EC=A0=80=EC=9E=A5=20=EB=A0=88=EC=9D=B4=EC=96=B4=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EB=B0=8F=20=EC=95=88=EB=93=9C?= =?UTF-8?q?=EB=A1=9C=EC=9D=B4=EB=93=9C=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- head.sub.php | 1 + js/modernizr.custom.70111.js | 4 ++++ skin/board/basic/style.css | 4 +++- skin/board/basic/write.skin.php | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 js/modernizr.custom.70111.js diff --git a/head.sub.php b/head.sub.php index fb27950a4..be6cb6823 100644 --- a/head.sub.php +++ b/head.sub.php @@ -75,6 +75,7 @@ if ($is_admin) { set_cookie("device_width", screen.width, 6, g4_cookie_domain); '.PHP_EOL; + echo ''.PHP_EOL; // overflow scroll 감지 } //if(!defined('G4_IS_ADMIN')) echo $config['cf_add_script']; diff --git a/js/modernizr.custom.70111.js b/js/modernizr.custom.70111.js new file mode 100644 index 000000000..1a81489fb --- /dev/null +++ b/js/modernizr.custom.70111.js @@ -0,0 +1,4 @@ +/* Modernizr 2.6.2 (Custom Build) | MIT & BSD + * Build: http://modernizr.com/download/#-cssclasses-testallprops-css_overflow_scrolling + */ +;window.Modernizr=function(a,b,c){function x(a){j.cssText=a}function y(a,b){return x(prefixes.join(a+";")+(b||""))}function z(a,b){return typeof a===b}function A(a,b){return!!~(""+a).indexOf(b)}function B(a,b){for(var d in a){var e=a[d];if(!A(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:z(f,"function")?f.bind(d||b):f}return!1}function D(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+n.join(d+" ")+d).split(" ");return z(b,"string")||z(b,"undefined")?B(e,b):(e=(a+" "+o.join(d+" ")+d).split(" "),C(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m="Webkit Moz O ms",n=m.split(" "),o=m.toLowerCase().split(" "),p={},q={},r={},s=[],t=s.slice,u,v={}.hasOwnProperty,w;!z(v,"undefined")&&!z(v.call,"undefined")?w=function(a,b){return v.call(a,b)}:w=function(a,b){return b in a&&z(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=t.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(t.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(t.call(arguments)))};return e});for(var E in p)w(p,E)&&(u=E.toLowerCase(),e[u]=p[E](),s.push((e[u]?"":"no-")+u));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)w(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},x(""),i=k=null,e._version=d,e._domPrefixes=o,e._cssomPrefixes=n,e.testProp=function(a){return B([a])},e.testAllProps=D,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+s.join(" "):""),e}(this,this.document),Modernizr.addTest("overflowscrolling",function(){return Modernizr.testAllProps("overflowScrolling")}); \ No newline at end of file diff --git a/skin/board/basic/style.css b/skin/board/basic/style.css index 60927815f..f7daa0c95 100644 --- a/skin/board/basic/style.css +++ b/skin/board/basic/style.css @@ -35,7 +35,9 @@ /* 게시판 쓰기 */ #autosave_wrapper {position:relative} -#autosave_pop {z-index:10;position:absolute;top:24px;right:117px;padding:8px;width:300px;border:1px solid #565656;background:#fff} +#autosave_pop {z-index:10;position:absolute;top:24px;right:117px;padding:8px;width:300px;height:auto !important;height:180px;max-height:180px;border:1px solid #565656;background:#fff;overflow-y:scroll} +html.no-overflowscrolling #autosave_pop {height:auto;max-height:10000px !important} /* overflow 미지원 기기 대응 */ +#autosave_pop strong {position:absolute;font-size:0;line-height:0;overflow:hidden} #autosave_pop div {text-align:right} #autosave_pop button {margin:0;padding:0;border:0;background:transparent} #autosave_pop ul {margin:10px 0;padding:0;border-top:1px solid #e9e9e9;list-style:none} diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index 0ffa3e0c9..2c1d783d9 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -111,13 +111,13 @@ echo $option_hidden;
- 임시 저장된 글 목록 + 임시 저장된 글 목록
    -
  • 저장제목일시
  • +
  • 저장제목일시
  • From f7fe04357c8fd9ec66e515bf030f90e07fd6fcc3 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Mon, 8 Jul 2013 11:32:29 +0900 Subject: [PATCH 04/11] =?UTF-8?q?=EC=9D=B4=EB=AF=B8=20HTML=20Entity=20?= =?UTF-8?q?=ED=98=95=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=A0=80=EC=9E=A5?= =?UTF-8?q?=EB=90=98=EB=AF=80=EB=A1=9C=20conv=5Fcontent()=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=A5=BC=20=EC=A0=9C=EA=B1=B0=ED=95=98=EC=97=AC=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=EB=A5=BC=20=EC=B6=9C=EB=A0=A5=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skin/connect/basic/current_connect.skin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/skin/connect/basic/current_connect.skin.php b/skin/connect/basic/current_connect.skin.php index 4913abe9d..db1159605 100644 --- a/skin/connect/basic/current_connect.skin.php +++ b/skin/connect/basic/current_connect.skin.php @@ -16,7 +16,8 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 ".$location.""; From d5983f284277b27e80ce013c222bff3527cf9e19 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Mon, 8 Jul 2013 15:19:33 +0900 Subject: [PATCH 05/11] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EC=A0=80=EC=9E=A5=20js?= =?UTF-8?q?on=20=EB=B2=84=EC=A0=84=20=EA=B0=9C=EB=B0=9C=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/ajax.autosave.php | 26 ++++---- bbs/ajax.autosavelist.php | 16 +++++ bbs/ajax.autosaveload.php | 15 +++++ skin/board/basic/style.css | 4 +- skin/board/basic/write.skin.php | 101 +++++++++++++++++++++++--------- 5 files changed, 120 insertions(+), 42 deletions(-) create mode 100644 bbs/ajax.autosavelist.php create mode 100644 bbs/ajax.autosaveload.php diff --git a/bbs/ajax.autosave.php b/bbs/ajax.autosave.php index 635d962a5..8adbd21e2 100644 --- a/bbs/ajax.autosave.php +++ b/bbs/ajax.autosave.php @@ -4,21 +4,19 @@ include_once('./_common.php'); if (!$is_member) die('0'); $uid = escape_trim($_REQUEST['uid']); -$subject = escape_trim($_REQUEST['subject']); -$content = escape_trim($_REQUEST['content']); +$subject = escape_trim(stripslashes($_REQUEST['subject'])); +$content = escape_trim(stripslashes($_REQUEST['content'])); +//$subject = escape_trim(htmlentities($_REQUEST['subject'], ENT_QUOTES)); +//$content = escape_trim($_REQUEST['content']); -/* -$uid = get_session("ss_autosave_uid"); -if (!$uid) { - $uid = get_uniqid(); - set_session("ss_autosave_uid", $uid); -} -*/ +if ($subject && $content) { + $sql = " select count(*) as cnt from {$g4['autosave_table']} where mb_id = '{$member['mb_id']}' and as_subject = '$subject' and as_content = '$content' "; + $row = sql_fetch($sql); + if (!$row['cnt']) { + $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); -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']); + echo autosave_count($member['mb_id']); + } } ?> \ No newline at end of file diff --git a/bbs/ajax.autosavelist.php b/bbs/ajax.autosavelist.php new file mode 100644 index 000000000..c0b9871c3 --- /dev/null +++ b/bbs/ajax.autosavelist.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/bbs/ajax.autosaveload.php b/bbs/ajax.autosaveload.php new file mode 100644 index 000000000..1cf047765 --- /dev/null +++ b/bbs/ajax.autosaveload.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/skin/board/basic/style.css b/skin/board/basic/style.css index f7daa0c95..53edf8163 100644 --- a/skin/board/basic/style.css +++ b/skin/board/basic/style.css @@ -35,7 +35,7 @@ /* 게시판 쓰기 */ #autosave_wrapper {position:relative} -#autosave_pop {z-index:10;position:absolute;top:24px;right:117px;padding:8px;width:300px;height:auto !important;height:180px;max-height:180px;border:1px solid #565656;background:#fff;overflow-y:scroll} +#autosave_pop {display:none;z-index:10;position:absolute;top:24px;right:117px;padding:8px;width:350px;height:auto !important;height:180px;max-height:180px;border:1px solid #565656;background:#fff;overflow-y:scroll} html.no-overflowscrolling #autosave_pop {height:auto;max-height:10000px !important} /* overflow 미지원 기기 대응 */ #autosave_pop strong {position:absolute;font-size:0;line-height:0;overflow:hidden} #autosave_pop div {text-align:right} @@ -45,6 +45,8 @@ html.no-overflowscrolling #autosave_pop {height:auto;max-height:10000px !importa #autosave_pop li:after {display:block;visibility:hidden;clear:both;content:""} #autosave_pop a {display:block;float:left} #autosave_pop span {display:block;float:right} +.autosave_close {cursor:pointer;} +.autosave_content {display:none;} /* 게시판 읽기 */ #bo_v {margin-bottom:20px;padding-bottom:20px} diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index 2c1d783d9..57f4e62b4 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -7,7 +7,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

    - + @@ -107,23 +107,18 @@ echo $option_hidden;
    - - - +
    임시 저장된 글 목록
    +
    @@ -238,27 +233,79 @@ function fwrite_submit(f) \ No newline at end of file + From 965a73c9dcc09841cf9b9d0abc3738db207452e5 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Mon, 8 Jul 2013 17:57:58 +0900 Subject: [PATCH 06/11] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EC=A0=80=EC=9E=A5=20xm?= =?UTF-8?q?l=20=EB=B2=84=EC=A0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bbs/ajax.autosave.php | 2 - bbs/ajax.autosavedel.php | 15 ++++++++ bbs/ajax.autosavelist.php | 15 +++++--- bbs/ajax.autosaveload.php | 13 ++++--- skin/board/basic/write.skin.php | 65 ++++++++++++++++++++------------- 5 files changed, 73 insertions(+), 37 deletions(-) create mode 100644 bbs/ajax.autosavedel.php diff --git a/bbs/ajax.autosave.php b/bbs/ajax.autosave.php index 8adbd21e2..f497d0bb1 100644 --- a/bbs/ajax.autosave.php +++ b/bbs/ajax.autosave.php @@ -6,8 +6,6 @@ if (!$is_member) die('0'); $uid = escape_trim($_REQUEST['uid']); $subject = escape_trim(stripslashes($_REQUEST['subject'])); $content = escape_trim(stripslashes($_REQUEST['content'])); -//$subject = escape_trim(htmlentities($_REQUEST['subject'], ENT_QUOTES)); -//$content = escape_trim($_REQUEST['content']); if ($subject && $content) { $sql = " select count(*) as cnt from {$g4['autosave_table']} where mb_id = '{$member['mb_id']}' and as_subject = '$subject' and as_content = '$content' "; diff --git a/bbs/ajax.autosavedel.php b/bbs/ajax.autosavedel.php new file mode 100644 index 000000000..30395b04d --- /dev/null +++ b/bbs/ajax.autosavedel.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/bbs/ajax.autosavelist.php b/bbs/ajax.autosavelist.php index c0b9871c3..68b214e75 100644 --- a/bbs/ajax.autosavelist.php +++ b/bbs/ajax.autosavelist.php @@ -3,14 +3,19 @@ include_once('./_common.php'); if (!$is_member) die(''); -$sql = " select as_id, as_subject, as_datetime from {$g4['autosave_table']} where mb_id = '{$member['mb_id']}' order by as_id desc "; +$sql = " select as_id, as_uid, as_subject, as_datetime from {$g4['autosave_table']} where mb_id = '{$member['mb_id']}' order by as_id desc "; $result = sql_query($sql); -$arr = array(); +echo "\n"; +echo "\n"; for ($i=0; $row=sql_fetch_array($result); $i++) { - //$subject = utf8_strcut(stripslashes($row['as_subject']), 25); $subject = htmlspecialchars(utf8_strcut($row['as_subject'], 25), ENT_QUOTES); $datetime = substr($row['as_datetime'],2,14); - $arr[] = "{\"id\": \"{$row['as_id']}\", \"subject\": \"{$subject}\", \"datetime\": \"{$datetime}\"}"; + echo "\n"; + echo "{$row['as_id']}\n"; + echo "{$row['as_uid']}\n"; + echo "\n"; + echo "{$datetime}\n"; + echo "\n"; } -echo "{\"autosave\":[".implode(", ", $arr)."]}"; +echo ""; ?> \ No newline at end of file diff --git a/bbs/ajax.autosaveload.php b/bbs/ajax.autosaveload.php index 1cf047765..2d90ab45c 100644 --- a/bbs/ajax.autosaveload.php +++ b/bbs/ajax.autosaveload.php @@ -7,9 +7,12 @@ $as_id = (int)$_REQUEST['as_id']; $sql = " select as_subject, as_content from {$g4['autosave_table']} where mb_id = '{$member['mb_id']}' and as_id = {$as_id} "; $row = sql_fetch($sql); -//$subject = stripslashes($row['as_subject']); -//$content = stripslashes($row['as_content']); -$subject = str_replace("\'", "\\\'", addslashes($row['as_subject'])); -$content = stripslashes($row['as_content']); -echo "{\"subject\":\"{$subject}\", \"content\":\"{$content}\"}"; +$subject = $row['as_subject']; +$content = $row['as_content']; + +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; ?> \ No newline at end of file diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index 57f4e62b4..5f60e0dcf 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -234,8 +234,8 @@ function fwrite_submit(f) From a1fab9775384afd00628449f301a524746e61148 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Mon, 8 Jul 2013 18:15:10 +0900 Subject: [PATCH 07/11] =?UTF-8?q?uniqid=20table=20=EC=97=90=20uq=5Fip=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/config_form.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/adm/config_form.php b/adm/config_form.php index 6bb587a95..32a6f7bfa 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -63,13 +63,34 @@ if(!isset($config['cf_facebook_appid'])) { } // uniqid 테이블이 없을 경우 생성 -if(!sql_query(" select uq_id from {$g4['uniqid_table']} limit 1 ", false)) { +if(!sql_query(" DESC {$g4['uniqid_table']} ", false)) { sql_query(" CREATE TABLE IF NOT EXISTS `{$g4['uniqid_table']}` ( `uq_id` bigint(20) unsigned NOT NULL, + `uq_ip` varchar(255) NOT NULL, PRIMARY KEY (`uq_id`) ) ", false); } +if(!sql_query(" SELECT uq_ip from {$g4['uniqid_table']} limit 1 ", false)) { + sql_query(" ALTER TABLE {$g4['uniqid_table']} ADD `uq_ip` VARCHAR(255) NOT NULL "); +} + + +// 임시저장 테이블이 없을 경우 생성 +if(!sql_query(" DESC {$g4['autosave_table']} ", false)) { + sql_query(" CREATE TABLE IF NOT EXISTS `{$g4['autosave_table']}` ( + `as_id` int(11) NOT NULL AUTO_INCREMENT, + `mb_id` varchar(20) NOT NULL, + `as_uid` bigint(20) unsigned NOT NULL, + `as_subject` varchar(255) NOT NULL, + `as_content` text NOT NULL, + `as_datetime` datetime NOT NULL, + PRIMARY KEY (`as_id`), + UNIQUE KEY `as_uid` (`as_uid`), + KEY `mb_id` (`mb_id`) + ) ", false); +} + $g4['title'] = '환경설정'; include_once ('./admin.head.php'); From b7d9285305b7d3ad7b8816d171c24237ae71f7e5 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Mon, 8 Jul 2013 18:15:31 +0900 Subject: [PATCH 08/11] =?UTF-8?q?autosave(=EC=9E=84=EC=8B=9C=EC=A0=80?= =?UTF-8?q?=EC=9E=A5)=20table=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install/gnuboard4s.sql | 21 ++++++++++++++++++++- install/install_db.php | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/install/gnuboard4s.sql b/install/gnuboard4s.sql index da7695538..ee3bf8f63 100644 --- a/install/gnuboard4s.sql +++ b/install/gnuboard4s.sql @@ -646,4 +646,23 @@ CREATE TABLE IF NOT EXISTS `g4s_syndi_log` ( PRIMARY KEY (`content_id`,`bbs_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; --- -------------------------------------------------------- \ No newline at end of file +-- -------------------------------------------------------- + +-- +-- Table structure for table `g4s_autosave` +-- + +DROP TABLE IF EXISTS `g4s_autosave`; +CREATE TABLE IF NOT EXISTS `g4s_autosave` ( + `as_id` int(11) NOT NULL AUTO_INCREMENT, + `mb_id` varchar(20) NOT NULL, + `as_uid` bigint(20) unsigned NOT NULL, + `as_subject` varchar(255) NOT NULL, + `as_content` text NOT NULL, + `as_datetime` datetime NOT NULL, + PRIMARY KEY (`as_id`), + UNIQUE KEY `as_uid` (`as_uid`), + KEY `mb_id` (`mb_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- diff --git a/install/install_db.php b/install/install_db.php index 7a2e9a0b1..936042d37 100644 --- a/install/install_db.php +++ b/install/install_db.php @@ -206,6 +206,7 @@ fwrite($f, "\$g4['visit_table'] = G4_TABLE_PREFIX.'visit'; // 방문자 테이 fwrite($f, "\$g4['visit_sum_table'] = G4_TABLE_PREFIX.'visit_sum'; // 방문자 합계 테이블\n"); fwrite($f, "\$g4['uniqid_table'] = G4_TABLE_PREFIX.'uniqid'; // 유니크한 값을 만드는 테이블\n"); fwrite($f, "\$g4['syndi_log_table'] = G4_TABLE_PREFIX.'syndi_log'; // 네이버 신디케이션 컨텐츠 삭제 로그 테이블\n"); +fwrite($f, "\$g4['autosave_table'] = G4_TABLE_PREFIX.'autosave'; // 게시글 작성시 일정시간마다 글을 임시 저장하는 테이블\n"); fwrite($f, " ?>"); fclose($f); From 7b3d5e883118ddae6d73227e33ad632df4a3304d Mon Sep 17 00:00:00 2001 From: gnuboard Date: Tue, 9 Jul 2013 14:19:12 +0900 Subject: [PATCH 09/11] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EC=A0=80=EC=9E=A5=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20js=20=ED=8C=8C=EC=9D=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/autosave.js | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 js/autosave.js diff --git a/js/autosave.js b/js/autosave.js new file mode 100644 index 000000000..f9684db1a --- /dev/null +++ b/js/autosave.js @@ -0,0 +1,98 @@ +// 임시 저장하는 시간을 초단위로 설정한다. +var AUTOSAVE_INTERVAL = 60; // 초 + +// 글의 제목과 내용을 바뀐 부분이 있는지 비교하기 위하여 저장해 놓는 변수 +var save_wr_subject = null; +var save_wr_content = null; + +function autosave() { + $("form#fwrite").each(function() { + if (typeof(CKEDITOR.instances.wr_content)!="undefined") + this.wr_content.value = CKEDITOR.instances.wr_content.getData(); + // 변수에 저장해 놓은 값과 다를 경우에만 임시 저장함 + if (save_wr_subject != this.wr_subject.value || save_wr_content != this.wr_content.value) { + $.ajax({ + url: g4_bbs_url+"/ajax.autosave.php", + data: { + "uid" : this.uid.value, + "subject": this.wr_subject.value, + "content": this.wr_content.value + }, + type: "POST", + success: function(data){ + if (data) { + $("#autosave_count").html(data); + } + } + }); + save_wr_subject = this.wr_subject.value; + save_wr_content = this.wr_content.value; + } + }); +} + +$(function(){ + + if (g4_is_member) { + setInterval(autosave, AUTOSAVE_INTERVAL * 1000); + } + + // 임시저장된 글목록을 가져옴 + $("#btn_autosave").click(function(){ + if ($("#autosave_pop").is(":hidden")) { + $.get(g4_bbs_url+"/ajax.autosavelist.php", function(data){ + //alert(data); + //console.log( "Data: " + data); + $("#autosave_pop ul").empty(); + if ($(data).find("list").find("item").length > 0) { + $(data).find("list").find("item").each(function(i) { + var id = $(this).find("id").text(); + var uid = $(this).find("uid").text(); + var subject = $(this).find("subject").text(); + var datetime = $(this).find("datetime").text(); + $("#autosave_pop ul").append('
  • '+subject+''+datetime+'
  • '); + $.data(document.body, "autosave_id"+i, id); + $.data(document.body, "autosave_uid"+i, uid); + }); + } + }, "xml"); + $("#autosave_pop").show(); + } else { + $("#autosave_pop").hide(); + } + }); + + // 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌 + $(".autosave_load").live("click", function(){ + var i = $(this).parents("li").index(); + var as_id = $.data(document.body, "autosave_id"+i); + var as_uid = $.data(document.body, "autosave_uid"+i); + $("#fwrite input[name='uid']").val(as_uid); + $.get(g4_bbs_url+"/ajax.autosaveload.php", {"as_id":as_id}, function(data){ + var subject = $(data).find("item").find("subject").text(); + var content = $(data).find("item").find("content").text(); + $("#wr_subject").val(subject); + if (typeof(CKEDITOR.instances.wr_content)!="undefined") { + CKEDITOR.instances.wr_content.setData(content); + } else { + $("#fwrite #wr_content").val(content); + } + }, "xml"); + $("#autosave_pop").hide(); + }); + + $(".autosave_del").live("click", function(){ + var i = $(this).parents("li").index(); + var as_id = $.data(document.body, "autosave_id"+i); + $.get(g4_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){ + if (data == -1) { + alert("임시 저장된글을 삭제중에 오류가 발생하였습니다."); + } else { + $("#autosave_count").html(data); + $("#autosave_pop ul > li").eq(i).remove(); + } + }); + }); + + $(".autosave_close").click(function(){ $("#autosave_pop").hide(); }); +}); From 5c6daebb3775c543a915e1dc78c9d7f315d74f3e Mon Sep 17 00:00:00 2001 From: gnuboard Date: Tue, 9 Jul 2013 14:19:45 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=EC=9E=84=EC=8B=9C=EC=A0=80=EC=9E=A5=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20js=20=ED=8C=8C=EC=9D=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skin/board/basic/write.skin.php | 103 +----------------------------- skin/board/gallery/write.skin.php | 14 +++- 2 files changed, 16 insertions(+), 101 deletions(-) diff --git a/skin/board/basic/write.skin.php b/skin/board/basic/write.skin.php index 5f60e0dcf..2122dd611 100644 --- a/skin/board/basic/write.skin.php +++ b/skin/board/basic/write.skin.php @@ -106,16 +106,13 @@ echo $option_hidden;
    - + +
    임시 저장된 글 목록
    -
      - - - -
    +
      @@ -230,97 +227,3 @@ function fwrite_submit(f) } - - diff --git a/skin/board/gallery/write.skin.php b/skin/board/gallery/write.skin.php index cec6ba51b..cab5d12a2 100644 --- a/skin/board/gallery/write.skin.php +++ b/skin/board/gallery/write.skin.php @@ -102,7 +102,19 @@ echo $option_hidden; - + + + + + +
      + 임시 저장된 글 목록 +
      +
        +
        +
        + + From 7e21174d2780f74390faf8f5158dfe6d5a308b25 Mon Sep 17 00:00:00 2001 From: gnuboard Date: Tue, 9 Jul 2013 14:27:42 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/gcaptcha/info.php | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 plugin/gcaptcha/info.php diff --git a/plugin/gcaptcha/info.php b/plugin/gcaptcha/info.php deleted file mode 100644 index ded7f9648..000000000 --- a/plugin/gcaptcha/info.php +++ /dev/null @@ -1,17 +0,0 @@ - \ No newline at end of file