게시판 비밀번호 저장 방식 및 여러가지 문제점 수정

This commit is contained in:
thisgun committed 2018-11-02 09:02:37 +09:00
1 parent 704ae9863f
commit e1c071a596
34 files changed
+194 -7892

No files matched your search

+6
View File
@@ -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";
+22
View File
@@ -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);
+3
View File
@@ -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비밀번호는 대소문자를 구분합니다.');
}
+9 -3
View File
@@ -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++)
{
+8 -5
View File
@@ -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);
+12 -3
View File
@@ -71,12 +71,21 @@ for ($i=0; $i<count($member_list['id']); $i++) {
$recv_mb_id = $member_list['id'][$i];
$recv_mb_nick = get_text($member_list['nick'][$i]);
// 쪽지 INSERT
$sql = " insert into {$g5['memo_table']} ( me_id, me_recv_mb_id, me_send_mb_id, me_send_datetime, me_memo ) values ( '$me_id', '$recv_mb_id', '{$member['mb_id']}', '".G5_TIME_YMDHIS."', '{$_POST['me_memo']}' ) ";
// 받는 회원 쪽지 INSERT
$sql = " insert into {$g5['memo_table']} ( me_recv_mb_id, me_send_mb_id, me_send_datetime, me_memo, me_type, me_send_ip ) values ( '$recv_mb_id', '{$member['mb_id']}', '".G5_TIME_YMDHIS."', '{$_POST['me_memo']}' , 'recv', '{$_SERVER['REMOTE_ADDR']}' ) ";
sql_query($sql);
if( $me_id = sql_insert_id() ){
// 보내는 회원 쪽지 INSERT
$sql = " insert into {$g5['memo_table']} ( me_recv_mb_id, me_send_mb_id, me_send_datetime, me_memo, me_send_id, me_type , me_send_ip ) values ( '$recv_mb_id', '{$member['mb_id']}', '".G5_TIME_YMDHIS."', '{$_POST['me_memo']}', '$me_id', 'send', '{$_SERVER['REMOTE_ADDR']}' ) ";
sql_query($sql);
}
// 실시간 쪽지 알림 기능
$sql = " update {$g5['member_table']} set mb_memo_call = '{$member['mb_id']}' where mb_id = '$recv_mb_id' ";
$sql = " update {$g5['member_table']} set mb_memo_call = '{$member['mb_id']}', mb_memo_cnt = '".get_memo_not_read($recv_mb_id)."' where mb_id = '$recv_mb_id' ";
sql_query($sql);
if (!$is_admin) {
+20 -20
View File
@@ -13,10 +13,13 @@ if ($kind == 'recv')
$sql = " update {$g5['memo_table']}
set me_read_datetime = '".G5_TIME_YMDHIS."'
where me_id = '$me_id'
where (me_id = '$me_id' or me_send_id = '$me_id' )
and me_recv_mb_id = '{$member['mb_id']}'
and me_read_datetime = '0000-00-00 00:00:00' ";
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);
}
else if ($kind == 'send')
{
@@ -37,31 +40,28 @@ $sql = " select * from {$g5['memo_table']}
$memo = sql_fetch($sql);
// 이전 쪽지
$sql = " select * from {$g5['memo_table']}
where me_id > '{$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.'&amp;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.'&amp;me_id='.$prev['me_id'];
$prev['page'] = ceil( (int)$prev['rownum'] / $config['cf_page_rows']); // 이동할 페이지 계산
if( (int)$prev['page'] > 0 ) $prev_link .= "&amp;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.'&amp;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 .= "&amp;page=".$next['page'];
} else {
$next_link = '';
}
$mb = get_member($memo['me_'.$unkind.'_mb_id']);
+1 -1
View File
@@ -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'] ){
+18 -2
View File
@@ -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'];
+4 -2
View File
@@ -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('댓글을 수정할 권한이 없습니다.');
}
+5 -2
View File
@@ -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<count($_FILES['bf_file']['name']); $i++) {
// 올라간 파일의 퍼미션을 변경합니다.
chmod($dest_file, G5_FILE_PERMISSION);
$dest_file = apply_replace('write_update_upload_file', $dest_file, $board, $wr_id, $w);
}
}
@@ -694,7 +696,8 @@ if (!($w == 'u' || $w == 'cu') && $config['cf_email_use'] && $board['bo_use_emai
// 중복된 메일 주소는 제거
$unique_email = array_unique($array_email);
$unique_email = array_values($unique_email);
$unique_email = apply_replace('write_update_mail_list', array_values($unique_email), $board, $wr_id);
for ($i=0; $i<count($unique_email); $i++) {
mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);
}
+32
View File
@@ -2,6 +2,7 @@
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
put_event('member_login_check', 'g54_userlogin_after', 10, 2);
put_event('memo_list', 'g54_user_memo_insert', 10, 3);
// 5.3 버전에서
function g54_userlogin_after($mb, $link){
@@ -24,4 +25,35 @@ function g54_userlogin_after($mb, $link){
}
}
}
function g54_user_memo_insert($kind, $unkind, $page=1){
global $g5, $is_member, $member;
if( ! $is_member || $kind !== 'send' ) return;
$sql = " select count(*) as cnt from {$g5['memo_table']} where me_send_mb_id = '{$member['mb_id']}' and me_type = 'recv' and me_send_ip = '' ";
$row = sql_fetch($sql);
if ( !$row['cnt'] ) return;
$sql = " select count(*) as cnt from {$g5['memo_table']} where me_send_mb_id = '{$member['mb_id']}' and me_type = 'send' ";
$row2 = sql_fetch($sql);
if( $row['cnt'] && ! $row2['cnt'] ){
$sql = " select * from {$g5['memo_table']} where me_send_mb_id = '{$member['mb_id']}' and me_type = 'recv' ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql = " insert into {$g5['memo_table']} ( me_recv_mb_id, me_send_mb_id, me_send_datetime, me_read_datetime, me_memo, me_send_id, me_type ) values ( '".addslashes($row['me_recv_mb_id'])."', '".addslashes($row['me_send_mb_id'])."', '".addslashes($row['me_send_datetime'])."', '".addslashes($row['me_read_datetime'])."', '".addslashes($row['me_memo'])."', '".$row['me_id']."', 'send' ) ";
sql_query($sql);
}
$sql = " update {$g5['memo_table']} set me_send_ip = '{$_SERVER['REMOTE_ADDR']}' where me_send_mb_id = '{$member['mb_id']}' and me_type = 'recv' and me_send_ip = '' ";
sql_query($sql);
}
}
?>
+2 -2
View File
@@ -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`),
-4
View File
@@ -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() ){
+5 -3
View File
@@ -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']}' ";
+24 -25
View File
@@ -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<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
for($i=0; $i<count($matches[1]); $i++)
{
// 이미지 path 구함
$p = parse_url($matches[1][$i]);
if(strpos($p['path'], '/'.G5_DATA_DIR.'/') != 0)
$data_path = preg_replace('/^\/.*\/'.G5_DATA_DIR.'/', '/'.G5_DATA_DIR, $p['path']);
else
$data_path = $p['path'];
$srcfile = G5_PATH.$data_path;
$srcfile = G5_PATH.$data_path;
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
if(preg_match("/\.({$config['cf_image_extension']})$/i", $srcfile) && is_file($srcfile)) {
$size = @getimagesize($srcfile);
if(empty($size))
continue;
$filename = basename($srcfile);
$filepath = dirname($srcfile);
$filename = basename($srcfile);
$filepath = dirname($srcfile);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = get_text($malt[1]);
preg_match("/alt=[\"\']?([^\"\']*)[\"\']?/", $matches[0][$i], $malt);
$alt = get_text($malt[1]);
break;
}
}
break;
}
} //end for
} //end if
}
if(!$filename)
+5 -1
View File
@@ -16,7 +16,11 @@ add_stylesheet('<link rel="stylesheet" href="'.$new_skin_url.'/style.css">', 0);
<option value="w">원글만
<option value="c">코멘트만
</select>
<input type="text" name="mb_id" value="<?php echo $mb_id ?>" id="mb_id" placeholder="검색어(필수)" required class="frm_input ">
<?php if ($is_admin) { // 만약 관리자이면 회원 아이디로 검색 ?>
<input type="text" name="mb_id" value="<?php echo $mb_id ?>" id="mb_id" placeholder="회원 아이디로 검색" required class="frm_input">
<?php } else { // 일반 회원이거나 비회원이면 회원 닉네임으로 검색 ?>
<input type="text" name="mb_nick" value="<?php echo get_text($mb_nick); ?>" id="mb_id" placeholder="회원 닉네임으로 검색" required class="frm_input">
<?php } ?>
<button type="submit" value="검색" class="btn_submit"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
<script>
-1
View File
@@ -1 +0,0 @@
/coverage/
-5
View File
@@ -1,5 +0,0 @@
language: php
php:
- 5.3
- 5.4
script: phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php
-3
View File
@@ -1,3 +0,0 @@
<?php
include_once("../../../common.php");
?>
-62
View File
@@ -1,62 +0,0 @@
<?php
include_once("./_common.php");
include_once(G5_SNS_PATH."/facebook/src/facebook.php");
$facebook = new Facebook(array(
'appId' => $config['cf_facebook_appid'],
'secret' => $config['cf_facebook_secret']
));
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = NULL;
}
}
$g5['title'] = '페이스북 콜백';
include_once(G5_PATH.'/head.sub.php');
if ($user) {
$sns_name = $user_profile['name'];
$sns_user = $user;
set_cookie('ck_sns_name', $sns_name, 86400);
set_session('ss_facebook_user', $user);
$g5_sns_url = G5_SNS_URL;
echo <<<EOT
<script>
$(function() {
document.write("<strong>페이스북 승인이 되었습니다.</strong>");
var opener = window.opener;
opener.$("#wr_name").val("{$sns_name}");
opener.$("#facebook_icon").attr("src", "{$g5_sns_url}/icon/facebook.png");
opener.$("#facebook_checked").attr("disabled", false);
opener.$("#facebook_checked").attr("checked", true);
window.close();
});
</script>
EOT;
} else {
echo <<<EOT
<script>
$(function() {
alert("페이스북 승인이 되지 않았습니다.");
window.close();
});
</script>
EOT;
}
include_once(G5_PATH.'/tail.sub.php');
?>
-28
View File
@@ -1,28 +0,0 @@
Facebook PHP SDK (v.3.0.0)
==========================
The new PHP SDK (v3.0.0) is a major upgrade to the older one (v2.2.x):
- Uses OAuth authentication flows instead of our legacy authentication flow
- Consists of two classes. The first (class BaseFacebook) maintains the core of the upgrade, and the second one (class Facebook) is a small subclass that uses PHP sessions to store the user id and access token.
If you’re currently using the PHP SDK (v2.2.x) for authentication, you will recall that the login code looked like this:
$facebook = new Facebook(…);
$session = $facebook->getSession();
if ($session) {
// proceed knowing you have a valid user session
} else {
// proceed knowing you require user login and/or authentication
}
The login code is now:
$facebook = new Facebook(…);
$user = $facebook->getUser();
if ($user) {
// proceed knowing you have a logged in user who's authenticated
} else {
// proceed knowing you require user login and/or authentication
}
-22
View File
@@ -1,22 +0,0 @@
{
"name": "facebook/php-sdk",
"description": "Facebook PHP SDK",
"keywords": ["facebook", "sdk"],
"type": "library",
"homepage": "https://github.com/facebook/facebook-php-sdk",
"license": "Apache2",
"authors": [
{
"name": "Facebook",
"homepage": "https://github.com/facebook/facebook-php-sdk/contributors"
}
],
"require": {
"php": ">=5.2.0",
"ext-curl": "*",
"ext-json": "*"
},
"autoload": {
"classmap": ["src"]
}
}
-85
View File
@@ -1,85 +0,0 @@
Facebook PHP SDK (v.3.2.2)
The [Facebook Platform](http://developers.facebook.com/) is
a set of APIs that make your app more social.
This repository contains the open source PHP SDK that allows you to
access Facebook Platform from your PHP app. Except as otherwise noted,
the Facebook PHP SDK is licensed under the Apache Licence, Version 2.0
(http://www.apache.org/licenses/LICENSE-2.0.html).
Usage
-----
The [examples][examples] are a good place to start. The minimal you'll need to
have is:
require 'facebook-php-sdk/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
));
// Get User ID
$user = $facebook->getUser();
To make [API][API] calls:
if ($user) {
try {
// Proceed knowing you have a logged in user who's authenticated.
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
Login or logout url will be needed depending on current user state.
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
[examples]: http://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php
[API]: http://developers.facebook.com/docs/api
Tests
-----
In order to keep us nimble and allow us to bring you new functionality, without
compromising on stability, we have ensured full test coverage of the SDK.
We are including this in the open source repository to assure you of our
commitment to quality, but also with the hopes that you will contribute back to
help keep it stable. The easiest way to do so is to file bugs and include a
test case.
The tests can be executed by using this command from the base directory:
phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php
Contributing
===========
For us to accept contributions you will have to first have signed the
[Contributor License Agreement](https://developers.facebook.com/opensource/cla).
When commiting, keep all lines to less than 80 characters, and try to
follow the existing style.
Before creating a pull request, squash your commits into a single commit.
Add the comments where needed, and provide ample explanation in the
commit message.
Report Issues/Bugs
===============
[Bugs](https://developers.facebook.com/bugs)
[Questions](http://facebook.stackoverflow.com)
File diff suppressed because it is too large. Load diff
-160
View File
@@ -1,160 +0,0 @@
<?php
/**
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
require_once "base_facebook.php";
/**
* Extends the BaseFacebook class with the intent of using
* PHP sessions to store user ids and access tokens.
*/
class Facebook extends BaseFacebook
{
const FBSS_COOKIE_NAME = 'fbss';
// We can set this to a high number because the main session
// expiration will trump this.
const FBSS_COOKIE_EXPIRE = 31556926; // 1 year
// Stores the shared session ID if one is set.
protected $sharedSessionID;
/**
* Identical to the parent constructor, except that
* we start a PHP session to store the user ID and
* access token if during the course of execution
* we discover them.
*
* @param Array $config the application configuration. Additionally
* accepts "sharedSession" as a boolean to turn on a secondary
* cookie for environments with a shared session (that is, your app
* shares the domain with other apps).
* @see BaseFacebook::__construct in facebook.php
*/
public function __construct($config) {
if (!session_id()) {
session_start();
}
parent::__construct($config);
if (!empty($config['sharedSession'])) {
$this->initSharedSession();
}
}
protected static $kSupportedKeys =
array('state', 'code', 'access_token', 'user_id');
protected function initSharedSession() {
$cookie_name = $this->getSharedSessionCookieName();
if (isset($_COOKIE[$cookie_name])) {
$data = $this->parseSignedRequest($_COOKIE[$cookie_name]);
if ($data && !empty($data['domain']) &&
self::isAllowedDomain($this->getHttpHost(), $data['domain'])) {
// good case
$this->sharedSessionID = $data['id'];
return;
}
// ignoring potentially unreachable data
}
// evil/corrupt/missing case
$base_domain = $this->getBaseDomain();
$this->sharedSessionID = md5(uniqid(mt_rand(), true));
$cookie_value = $this->makeSignedRequest(
array(
'domain' => $base_domain,
'id' => $this->sharedSessionID,
)
);
$_COOKIE[$cookie_name] = $cookie_value;
if (!headers_sent()) {
$expire = time() + self::FBSS_COOKIE_EXPIRE;
setcookie($cookie_name, $cookie_value, $expire, '/', '.'.$base_domain);
} else {
// @codeCoverageIgnoreStart
self::errorLog(
'Shared session ID cookie could not be set! You must ensure you '.
'create the Facebook instance before headers have been sent. This '.
'will cause authentication issues after the first request.'
);
// @codeCoverageIgnoreEnd
}
}
/**
* Provides the implementations of the inherited abstract
* methods. The implementation uses PHP sessions to maintain
* a store for authorization codes, user ids, CSRF states, and
* access tokens.
*/
protected function setPersistentData($key, $value) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to setPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
$_SESSION[$session_var_name] = $value;
}
protected function getPersistentData($key, $default = false) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to getPersistentData.');
return $default;
}
$session_var_name = $this->constructSessionVariableName($key);
return isset($_SESSION[$session_var_name]) ?
$_SESSION[$session_var_name] : $default;
}
protected function clearPersistentData($key) {
if (!in_array($key, self::$kSupportedKeys)) {
self::errorLog('Unsupported key passed to clearPersistentData.');
return;
}
$session_var_name = $this->constructSessionVariableName($key);
unset($_SESSION[$session_var_name]);
}
protected function clearAllPersistentData() {
foreach (self::$kSupportedKeys as $key) {
$this->clearPersistentData($key);
}
if ($this->sharedSessionID) {
$this->deleteSharedSessionCookie();
}
}
protected function deleteSharedSessionCookie() {
$cookie_name = $this->getSharedSessionCookieName();
unset($_COOKIE[$cookie_name]);
$base_domain = $this->getBaseDomain();
setcookie($cookie_name, '', 1, '/', '.'.$base_domain);
}
protected function getSharedSessionCookieName() {
return self::FBSS_COOKIE_NAME . '_' . $this->getAppId();
}
protected function constructSessionVariableName($key) {
$parts = array('fb', $this->getAppId(), $key);
if ($this->sharedSessionID) {
array_unshift($parts, $this->sharedSessionID);
}
return implode('_', $parts);
}
}
File diff suppressed because it is too large. Load diff
-5
View File
@@ -1,5 +0,0 @@
<?php
$base = realpath(dirname(__FILE__) . '/..');
require "$base/src/base_facebook.php";
require "$base/src/facebook.php";
File diff suppressed because it is too large. Load diff
@@ -6,47 +6,6 @@ if (!$board['bo_use_sns']) return;
<ul id="bo_vc_sns">
<?php
//============================================================================
// 페이스북
//----------------------------------------------------------------------------
if ($config['cf_facebook_appid']) {
$facebook_user = get_session("ss_facebook_user");
if (!$facebook_user) {
include_once(G5_SNS_PATH."/facebook/src/facebook.php");
$facebook = new Facebook(array(
'appId' => $config['cf_facebook_appid'],
'secret' => $config['cf_facebook_secret']
));
$facebook_user = $facebook->getUser();
if ($facebook_user) {
try {
$facebook_user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
$facebook_user = null;
}
}
}
echo '<li class="sns_li_f '.($facebook_user?'':'sns_li_off').'">';
if ($facebook_user) {
echo '<img src="'.G5_SNS_URL.'/icon/facebook.png" id="facebook_icon">';
echo '<label for="" class="sound_only">페이스북 동시 등록</label>';
echo '<input type="checkbox" name="facebook_checked" id="facebook_checked" '.(get_cookie('ck_facebook_checked')?'checked':'').' value="1">';
} else {
$facebook_url = $facebook->getLoginUrl(array("redirect_uri"=>G5_SNS_URL."/facebook/callback.php", "scope"=>"publish_stream,read_stream,offline_access", "display"=>"popup"));
echo '<input type="checkbox" name="facebook_checked" id="facebook_checked" disabled value="1">';
echo '<a href="'.$facebook_url.'" id="facebook_url" onclick="return false;"><img src="'.G5_SNS_URL.'/icon/facebook.png" id="facebook_icon" width="20"></a>';
echo '<label for="" class="sound_only">페이스북 동시 등록</label>';
echo '<script>$(function(){ $(document).on("click", "#facebook_url", function(){ window.open(this.href, "facebook_url", "width=600,height=250"); }); });</script>';
}
echo '</li>';
}
//============================================================================
//============================================================================
// 트위터
//----------------------------------------------------------------------------
+1 -1
View File
@@ -63,7 +63,7 @@ var char_max = parseInt(<?php echo $comment_max ?>); // 최대
?>
<ul class="bo_vc_act">
<?php if ($list[$i]['is_reply']) { ?><li><a href="<?php echo $c_reply_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'c'); return false;" class="btn_b03">답변</a></li><?php } ?>
<?php if ($list[$i]['is_edit']) { ?><li><a href="<?php echo $c_edit_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;" class="btn_b03">수정</a></li><?php } ?>
<?php if (1==1) { ?><li><a href="<?php echo $c_edit_href; ?>" onclick="comment_box('<?php echo $comment_id ?>', 'cu'); return false;" class="btn_b03">수정</a></li><?php } ?>
<?php if ($list[$i]['is_del']) { ?><li><a href="<?php echo $list[$i]['del_link']; ?>" onclick="return comment_delete();" class="btn_b03">삭제</a></li><?php } ?>
</ul>
<?php } ?>
+7 -2
View File
@@ -22,9 +22,13 @@ add_stylesheet('<link rel="stylesheet" href="'.$new_skin_url.'/style.css">', 0);
<option value="c">코멘트만
</select>
<label for="mb_id" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<?php if ($is_admin) { // 만약 관리자이면 회원 아이디로 검색 ?>
<input type="text" name="mb_id" value="<?php echo $mb_id ?>" id="mb_id" required class="frm_input" size="40">
<?php } else { // 일반 회원이거나 비회원이면 회원 닉네임으로 검색 ?>
<input type="text" name="mb_nick" value="<?php echo get_text($mb_nick); ?>" id="mb_id" required class="frm_input" size="40">
<?php } ?>
<button type="submit" class="btn_submit"><i class="fa fa-search" aria-hidden="true"></i> 검색</button>
<p>회원 아이디만 검색 가능</p>
<p><?php echo $is_admin ? '회원 아이디만 검색 가능' : '회원 닉네임만 검색 가능'; ?></p>
</form>
<script>
/* 셀렉트 박스에서 자동 이동 해제
@@ -74,6 +78,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$new_skin_url.'/style.css">', 0);
$gr_subject = cut_str($list[$i]['gr_subject'], 20);
$bo_subject = cut_str($list[$i]['bo_subject'], 20);
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 80));
$board_url = get_pretty_url($list[$i]['bo_table']);
?>
<tr>
<?php if ($is_admin) { ?>
@@ -85,7 +90,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$new_skin_url.'/style.css">', 0);
</td>
<?php } ?>
<td class="td_group"><a href="./new.php?gr_id=<?php echo $list[$i]['gr_id'] ?>"><?php echo $gr_subject ?></a></td>
<td class="td_board"><a href="./board.php?bo_table=<?php echo $list[$i]['bo_table'] ?>"><?php echo $bo_subject ?></a></td>
<td class="td_board"><a href="<?php echo $board_url; ?>"><?php echo $bo_subject ?></a></td>
<td><a href="<?php echo $list[$i]['href'] ?>" class="new_tit"><?php echo $list[$i]['comment'] ?><?php echo $wr_subject ?></a></td>
<td class="td_name"><?php echo $list[$i]['name'] ?></td>
<td class="td_date"><?php echo $list[$i]['datetime2'] ?></td>
@@ -16,7 +16,11 @@ add_stylesheet('<link rel="stylesheet" href="'.$new_skin_url.'/style.css">', 0);
<option value="w">원글만
<option value="c">코멘트만
</select>
<input type="text" name="mb_id" value="<?php echo $mb_id ?>" id="mb_id" placeholder="검색어(필수)" required class="frm_input ">
<?php if ($is_admin) { // 만약 관리자이면 회원 아이디로 검색 ?>
<input type="text" name="mb_id" value="<?php echo $mb_id ?>" id="mb_id" placeholder="회원 아이디로 검색" required class="frm_input">
<?php } else { // 일반 회원이거나 비회원이면 회원 닉네임으로 검색 ?>
<input type="text" name="mb_nick" value="<?php echo get_text($mb_nick); ?>" id="mb_id" placeholder="회원 닉네임으로 검색" required class="frm_input">
<?php } ?>
<button type="submit" value="검색" class="btn_submit"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
<script>
+5 -1
View File
@@ -22,9 +22,13 @@ add_stylesheet('<link rel="stylesheet" href="'.$new_skin_url.'/style.css">', 0);
<option value="c">코멘트만
</select>
<label for="mb_id" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<?php if ($is_admin) { // 만약 관리자이면 회원 아이디로 검색 ?>
<input type="text" name="mb_id" value="<?php echo $mb_id ?>" id="mb_id" required class="frm_input" size="40">
<?php } else { // 일반 회원이거나 비회원이면 회원 닉네임으로 검색 ?>
<input type="text" name="mb_nick" value="<?php echo get_text($mb_nick); ?>" id="mb_id" required class="frm_input" size="40">
<?php } ?>
<button type="submit" class="btn_submit"><i class="fa fa-search" aria-hidden="true"></i> 검색</button>
<p>회원 아이디만 검색 가능</p>
<p><?php echo $is_admin ? '회원 아이디만 검색 가능' : '회원 닉네임만 검색 가능'; ?></p>
</form>
<script>
/* 셀렉트 박스에서 자동 이동 해제