From e1c071a59611b6963a56aada1e6c915416eff798 Mon Sep 17 00:00:00 2001 From: thisgun Date: Fri, 2 Nov 2018 09:02:37 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EB=B9=84?= =?UTF-8?q?=EB=B0=80=EB=B2=88=ED=98=B8=20=EC=A0=80=EC=9E=A5=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B0=8F=20=EC=97=AC=EB=9F=AC=EA=B0=80=EC=A7=80=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=EC=A0=90=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adm/config_form.php | 6 + adm/dbupgrade.php | 22 + bbs/login_check.php | 3 + bbs/memo.php | 12 +- bbs/memo_delete.php | 13 +- bbs/memo_form_update.php | 15 +- bbs/memo_view.php | 40 +- bbs/new.php | 2 +- bbs/password_check.php | 20 +- bbs/write_comment_update.php | 6 +- bbs/write_update.php | 7 +- extend/g5_54version_update.extend.php | 32 + install/gnuboard5.sql | 4 +- lib/hook.lib.php | 4 - lib/outlogin.lib.php | 8 +- lib/thumbnail.lib.php | 49 +- mobile/skin/new/basic/new.skin.php | 6 +- plugin/sns/facebook/.gitignore | 1 - plugin/sns/facebook/.travis.yml | 5 - plugin/sns/facebook/_common.php | 3 - plugin/sns/facebook/callback.php | 62 - plugin/sns/facebook/changelog.md | 28 - plugin/sns/facebook/composer.json | 22 - plugin/sns/facebook/readme.md | 85 - plugin/sns/facebook/src/base_facebook.php | 1444 ------ plugin/sns/facebook/src/facebook.php | 160 - .../sns/facebook/src/fb_ca_chain_bundle.crt | 3920 ----------------- plugin/sns/facebook/tests/bootstrap.php | 5 - plugin/sns/facebook/tests/tests.php | 2038 --------- plugin/sns/view_comment_write.sns.skin.php | 41 - skin/board/basic/view_comment.skin.php | 2 +- skin/new/basic/new.skin.php | 9 +- .../basic/mobile/skin/new/basic/new.skin.php | 6 +- theme/basic/skin/new/basic/new.skin.php | 6 +- 34 files changed, 194 insertions(+), 7892 deletions(-) delete mode 100644 plugin/sns/facebook/.gitignore delete mode 100644 plugin/sns/facebook/.travis.yml delete mode 100644 plugin/sns/facebook/_common.php delete mode 100644 plugin/sns/facebook/callback.php delete mode 100644 plugin/sns/facebook/changelog.md delete mode 100644 plugin/sns/facebook/composer.json delete mode 100644 plugin/sns/facebook/readme.md delete mode 100644 plugin/sns/facebook/src/base_facebook.php delete mode 100644 plugin/sns/facebook/src/facebook.php delete mode 100644 plugin/sns/facebook/src/fb_ca_chain_bundle.crt delete mode 100644 plugin/sns/facebook/tests/bootstrap.php delete mode 100644 plugin/sns/facebook/tests/tests.php diff --git a/adm/config_form.php b/adm/config_form.php index d0efb3150..9a963faf7 100644 --- a/adm/config_form.php +++ b/adm/config_form.php @@ -259,6 +259,12 @@ if (!isset($config['cf_bbs_rewrite'])) { ADD `cf_bbs_rewrite` tinyint(4) NOT NULL DEFAULT '0' AFTER `cf_link_target` ", true); } +// 읽지 않은 메모 수 칼럼 +if(!isset($member['mb_memo_cnt'])) { + sql_query(" ALTER TABLE `{$g5['member_table']}` + ADD `mb_memo_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_call`", true); +} + if(!$config['cf_faq_skin']) $config['cf_faq_skin'] = "basic"; if(!$config['cf_mobile_faq_skin']) $config['cf_mobile_faq_skin'] = "basic"; diff --git a/adm/dbupgrade.php b/adm/dbupgrade.php index d61b41b36..52f94bd30 100644 --- a/adm/dbupgrade.php +++ b/adm/dbupgrade.php @@ -122,7 +122,29 @@ while ($row = sql_fetch_array($result)) { sql_query($sql); } +} +// 메모 테이블 +$sql = " SHOW COLUMNS FROM `{$g5['memo_table']}` LIKE 'me_send_id' "; +$row = sql_fetch($sql); + +if( !$row ){ + sql_query("ALTER TABLE `{$g5['memo_table']}` + ADD `me_send_id` INT(11) NOT NULL DEFAULT '0', + ADD `me_type` ENUM('send','recv') NOT NULL DEFAULT 'recv', + ADD `me_send_ip` VARCHAR(100) NOT NULL DEFAULT '', + CHANGE COLUMN `me_id` `me_id` INT(11) NOT NULL AUTO_INCREMENT; + ", false); + + $is_check = true; +} + +// 읽지 않은 메모 수 칼럼 +if(!isset($member['mb_memo_cnt'])) { + sql_query(" ALTER TABLE `{$g5['member_table']}` + ADD `mb_memo_cnt` int(11) NOT NULL DEFAULT '0' AFTER `mb_memo_call`", true); + + $is_check = true; } $is_check = apply_replace('admin_dbupgrade', $is_check); diff --git a/bbs/login_check.php b/bbs/login_check.php index 1337657ff..07fa4da78 100644 --- a/bbs/login_check.php +++ b/bbs/login_check.php @@ -30,6 +30,9 @@ if(function_exists('social_is_login_check')){ // 회원아이디를 입력해 보고 맞으면 또 비밀번호를 입력해보는 경우를 방지하기 위해서입니다. // 불법사용자의 경우 회원아이디가 틀린지, 비밀번호가 틀린지를 알기까지는 많은 시간이 소요되기 때문입니다. if (!$is_social_password_check && (!$mb['mb_id'] || !login_password_check($mb, $mb_password, $mb['mb_password'])) ) { + + start_event('password_is_wrong', 'login', $mb); + alert('가입된 회원아이디가 아니거나 비밀번호가 틀립니다.\\n비밀번호는 대소문자를 구분합니다.'); } diff --git a/bbs/memo.php b/bbs/memo.php index 72ba5b33e..b8d9f7d93 100644 --- a/bbs/memo.php +++ b/bbs/memo.php @@ -18,12 +18,15 @@ else if ($kind == 'send') else alert(''.$kind .'값을 넘겨주세요.'); -$sql = " select count(*) as cnt from {$g5['memo_table']} where me_{$kind}_mb_id = '{$member['mb_id']}' "; +if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) + +start_event('memo_list', $kind, $unkind, $page); + +$sql = " select count(*) as cnt from {$g5['memo_table']} where me_{$kind}_mb_id = '{$member['mb_id']}' and me_type = '$kind' "; $row = sql_fetch($sql); $total_count = $row['cnt']; $total_page = ceil($total_count / $config['cf_page_rows']); // 전체 페이지 계산 -if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지) $from_record = ((int) $page - 1) * $config['cf_page_rows']; // 시작 열을 구함 if ($kind == 'recv') @@ -44,8 +47,11 @@ $list = array(); $sql = " select a.*, b.mb_id, b.mb_nick, b.mb_email, b.mb_homepage from {$g5['memo_table']} a left join {$g5['member_table']} b on (a.me_{$unkind}_mb_id = b.mb_id) - where a.me_{$kind}_mb_id = '{$member['mb_id']}' + where a.me_{$kind}_mb_id = '{$member['mb_id']}' and a.me_type = '$kind' order by a.me_id desc limit $from_record, {$config['cf_page_rows']} "; + +echo $sql; + $result = sql_query($sql); for ($i=0; $row=sql_fetch_array($result); $i++) { diff --git a/bbs/memo_delete.php b/bbs/memo_delete.php index 87e3ae853..6a46cc862 100644 --- a/bbs/memo_delete.php +++ b/bbs/memo_delete.php @@ -15,6 +15,11 @@ $me_id = (int)$_REQUEST['me_id']; $sql = " select * from {$g5['memo_table']} where me_id = '{$me_id}' "; $row = sql_fetch($sql); +$sql = " delete from {$g5['memo_table']} + where me_id = '{$me_id}' + and (me_recv_mb_id = '{$member['mb_id']}' or me_send_mb_id = '{$member['mb_id']}') "; +sql_query($sql); + if (!$row['me_read_datetime'][0]) // 메모 받기전이면 { $sql = " update {$g5['member_table']} @@ -22,12 +27,10 @@ if (!$row['me_read_datetime'][0]) // 메모 받기전이면 where mb_id = '{$row['me_recv_mb_id']}' and mb_memo_call = '{$row['me_send_mb_id']}' "; sql_query($sql); -} -$sql = " delete from {$g5['memo_table']} - where me_id = '{$me_id}' - and (me_recv_mb_id = '{$member['mb_id']}' or me_send_mb_id = '{$member['mb_id']}') "; -sql_query($sql); + $sql = " update `{$g5['member_table']}` set mb_memo_cnt = '".get_memo_not_read($member['mb_id'])."' where mb_id = '{$member['mb_id']}' "; + sql_query($sql); +} start_event('memo_delete', $me_id, $row); diff --git a/bbs/memo_form_update.php b/bbs/memo_form_update.php index ae5a3a9f0..40b36c50d 100644 --- a/bbs/memo_form_update.php +++ b/bbs/memo_form_update.php @@ -71,12 +71,21 @@ for ($i=0; $i '{$me_id}' - and me_{$kind}_mb_id = '{$member['mb_id']}' - order by me_id asc - limit 1 "; -$prev = sql_fetch($sql); -if ($prev['me_id']) - $prev_link = './memo_view.php?kind='.$kind.'&me_id='.$prev['me_id']; -else - //$prev_link = 'javascript:alert(\'쪽지의 처음입니다.\');'; - $prev_link = ''; +$sql = " select me.*, a.rownum from `{$g5['memo_table']}` as me inner join ( select me_id , (@rownum:=@rownum+1) as rownum from `{$g5['memo_table']}` as memo, (select @rownum:=0) tmp where me_{$kind}_mb_id = '{$member['mb_id']}' and memo.me_type = '$kind' order by me_id desc ) as a on a.me_id = me.me_id where me.me_id < '$me_id' and me.me_{$kind}_mb_id = '{$member['mb_id']}' and me.me_type = '$kind' order by me.me_id desc limit 1 "; +$prev = sql_fetch($sql); +if ($prev['me_id']) { + $prev_link = './memo_view.php?kind='.$kind.'&me_id='.$prev['me_id']; + $prev['page'] = ceil( (int)$prev['rownum'] / $config['cf_page_rows']); // 이동할 페이지 계산 + if( (int)$prev['page'] > 0 ) $prev_link .= "&page=".$prev['page']; +} else { + $prev_link = ''; +} // 다음 쪽지 -$sql = " select * from {$g5[memo_table]} - where me_id < '{$me_id}' - and me_{$kind}_mb_id = '{$member[mb_id]}' - order by me_id desc - limit 1 "; +$sql = " select me.*, a.rownum from `{$g5['memo_table']}` as me inner join ( select me_id , (@rownum:=@rownum+1) as rownum from `{$g5['memo_table']}` as memo, (select @rownum:=0) tmp where me_{$kind}_mb_id = '{$member['mb_id']}' and memo.me_type = '$kind' order by me_id asc ) as a on a.me_id = me.me_id where me.me_id > '$me_id' and me.me_{$kind}_mb_id = '{$member['mb_id']}' and me.me_type = '$kind' order by me.me_id asc limit 1 "; + $next = sql_fetch($sql); -if ($next['me_id']) +if ($next['me_id']) { $next_link = './memo_view.php?kind='.$kind.'&me_id='.$next['me_id']; -else - //$next_link = 'javascript:alert(\'쪽지의 마지막입니다.\');'; + $next['page'] = ceil( (int)$next['rownum'] / $config['cf_page_rows']); // 이동할 페이지 계산 + if( (int)$next['page'] > 0 ) $next_link .= "&page=".$next['page']; +} else { $next_link = ''; +} $mb = get_member($memo['me_'.$unkind.'_mb_id']); diff --git a/bbs/new.php b/bbs/new.php index fca91fb56..bb20b3204 100644 --- a/bbs/new.php +++ b/bbs/new.php @@ -23,7 +23,7 @@ else if(isset($mb_nick) && $mb_nick){ // 닉네임으로 요청한 경우 $mb_nick = get_search_string(strip_tags($mb_nick)); - $sql = "select mb_id from `{$gml['member_table']}` where mb_nick = '".sql_real_escape_string($mb_nick)."' "; + $sql = "select mb_id from `{$g5['member_table']}` where mb_nick = '".sql_real_escape_string($mb_nick)."' "; $mb = sql_fetch($sql); if( $mb['mb_id'] ){ diff --git a/bbs/password_check.php b/bbs/password_check.php index b13e6fc85..01292b017 100644 --- a/bbs/password_check.php +++ b/bbs/password_check.php @@ -6,8 +6,16 @@ if ($w == 's') { $wr = get_write($write_table, $wr_id); - if (!check_password($wr_password, $wr['wr_password'])) + if( !$wr['wr_password'] && $wr['mb_id'] ){ + if ( $mb = get_member($wr['mb_id']) ){ + $wr['wr_password'] = $mb['mb_password']; + } + } + + if (!check_password($wr_password, $wr['wr_password'])) { + start_event('password_is_wrong', 'bbs', $wr); alert('비밀번호가 틀립니다.'); + } // 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임. //$ss_name = 'ss_secret.'_'.$bo_table.'_'.$wr_id'; @@ -20,8 +28,16 @@ if ($w == 's') { $wr = get_write($write_table, $wr_id); - if (!check_password($wr_password, $wr['wr_password'])) + if( !$wr['wr_password'] && $wr['mb_id'] ){ + if ( $mb = get_member($wr['mb_id']) ){ + $wr['wr_password'] = $mb['mb_password']; + } + } + + if (!check_password($wr_password, $wr['wr_password'])){ + start_event('password_is_wrong', 'bbs', $wr); alert('비밀번호가 틀립니다.'); + } // 세션에 아래 정보를 저장. 하위번호는 비밀번호없이 보아야 하기 때문임. $ss_name = 'ss_secret_comment_'.$bo_table.'_'.$wr['wr_id']; diff --git a/bbs/write_comment_update.php b/bbs/write_comment_update.php index 224cda5b4..ea02128a6 100644 --- a/bbs/write_comment_update.php +++ b/bbs/write_comment_update.php @@ -54,18 +54,20 @@ if (empty($wr['wr_id'])) // 이 옵션을 사용 안 함으로 설정할 경우 어떤 스크립트도 실행 되지 않습니다. //if (!trim($_POST["wr_content"])) die ("내용을 입력하여 주십시오."); +$post_wr_password = ''; if ($is_member) { $mb_id = $member['mb_id']; // 4.00.13 - 실명 사용일때 댓글에 닉네임으로 입력되던 오류를 수정 $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick'])); - $wr_password = $member['mb_password']; + $wr_password = ''; $wr_email = addslashes($member['mb_email']); $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); } else { $mb_id = ''; + $post_wr_password = $wr_password; $wr_password = get_encrypt_string($wr_password); } @@ -289,7 +291,7 @@ else if ($w == 'cu') // 댓글 수정 if ($member['mb_id'] !== $comment['mb_id']) alert('자신의 글이 아니므로 수정할 수 없습니다.'); } else { - if($comment['wr_password'] != $wr_password) + if( !($comment['mb_id'] === '' && $comment['wr_password'] && check_password($post_wr_password, $comment['wr_password'])) ) alert('댓글을 수정할 권한이 없습니다.'); } diff --git a/bbs/write_update.php b/bbs/write_update.php index 36d6cdd38..3822ff888 100644 --- a/bbs/write_update.php +++ b/bbs/write_update.php @@ -220,7 +220,7 @@ 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 = $member['mb_password']; + $wr_password = ''; $wr_email = addslashes($member['mb_email']); $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage'])); } else { @@ -552,6 +552,8 @@ for ($i=0; $i \ No newline at end of file diff --git a/install/gnuboard5.sql b/install/gnuboard5.sql index 5042bbc1f..5c3d965f8 100644 --- a/install/gnuboard5.sql +++ b/install/gnuboard5.sql @@ -491,6 +491,7 @@ CREATE TABLE IF NOT EXISTS `g5_member` ( `mb_open_date` date NOT NULL default '0000-00-00', `mb_profile` text NOT NULL, `mb_memo_call` varchar(255) NOT NULL default '', + `mb_memo_cnt` int(11) NOT NULL DEFAULT '0', `mb_1` varchar(255) NOT NULL default '', `mb_2` varchar(255) NOT NULL default '', `mb_3` varchar(255) NOT NULL default '', @@ -522,8 +523,7 @@ CREATE TABLE IF NOT EXISTS `g5_memo` ( `me_read_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `me_memo` text NOT NULL, `me_send_id` INT(11) NOT NULL DEFAULT '0', - `me_type` ENUM('send','receive') NOT NULL DEFAULT 'receive', - `me_readed` TINYINT(4) NOT NULL DEFAULT '0', + `me_type` ENUM('send','recv') NOT NULL DEFAULT 'recv', `me_send_ip` VARCHAR(100) NOT NULL DEFAULT '', `me_memo` text NOT NULL, PRIMARY KEY (`me_id`), diff --git a/lib/hook.lib.php b/lib/hook.lib.php index 77ca17253..f383da7f1 100644 --- a/lib/hook.lib.php +++ b/lib/hook.lib.php @@ -16,7 +16,6 @@ function get_hook_class(){ } function put_event($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=0){ - global $gml; if( $hook = get_hook_class() ){ $hook::addAction($tag, $func, $priority, $args); @@ -24,7 +23,6 @@ function put_event($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=0){ } function start_event($tag, $arg = ''){ - global $gml; if( $hook = get_hook_class() ){ @@ -55,7 +53,6 @@ function start_event($tag, $arg = ''){ } function put_replace($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=0){ - global $gml; if( $hook = get_hook_class() ){ return $hook::addFilter($tag, $func, $priority, $args); @@ -65,7 +62,6 @@ function put_replace($tag, $func, $priority=G5_HOOK_DEFAULT_PRIORITY, $args=0){ } function apply_replace($tag, $arg = ''){ - global $gml; if( $hook = get_hook_class() ){ diff --git a/lib/outlogin.lib.php b/lib/outlogin.lib.php index 912777199..47ba4185c 100644 --- a/lib/outlogin.lib.php +++ b/lib/outlogin.lib.php @@ -36,9 +36,11 @@ function outlogin($skin_dir='basic') // 읽지 않은 쪽지가 있다면 if ($is_member) { - $sql = " select count(*) as cnt from {$g5['memo_table']} where me_recv_mb_id = '{$member['mb_id']}' and me_read_datetime = '0000-00-00 00:00:00' "; - $row = sql_fetch($sql); - $memo_not_read = $row['cnt']; + if( isset($member['mb_memo_cnt']) ){ + $memo_not_read = $member['mb_memo_cnt']; + } else { + $memo_not_read = get_memo_not_read($member['mb_id']); + } $is_auth = false; $sql = " select count(*) as cnt from {$g5['auth_table']} where mb_id = '{$member['mb_id']}' "; diff --git a/lib/thumbnail.lib.php b/lib/thumbnail.lib.php index 81f1da0fe..448f649d7 100644 --- a/lib/thumbnail.lib.php +++ b/lib/thumbnail.lib.php @@ -17,37 +17,36 @@ function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_ $filepath = G5_DATA_PATH.'/file/'.$bo_table; $alt = get_text($row['bf_content']); } else { - $write_table = $g5['write_prefix'].$bo_table; - $sql = " select wr_content from $write_table where wr_id = '$wr_id' "; - $write = sql_fetch($sql); - $matches = get_editor_image($write['wr_content'], false); + $write = get_thumbnail_find_cache($bo_table, $wr_id, 'content'); $edt = true; + + if( $matches = get_editor_image($write['wr_content'], false) ){ + for($i=0; $i', 0);