1837 lines
72 KiB
PHP
Executable File
1837 lines
72 KiB
PHP
Executable File
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
|
header("Content-Type: text/html; charset=UTF-8");
|
|
/**
|
|
* 인클루드 class
|
|
*
|
|
* cm_controller: 부모 Class(CI_Controller 확장한 custome class)
|
|
*/
|
|
include_once(APPPATH.'core/web/cm_controller.php');
|
|
class comm extends cm_Controller {
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 리뷰쓰기
|
|
# CREATE : 2018-04-16
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_review_proc() {
|
|
# request
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
$idx = trim($this->input->get_post('idx', TRUE));
|
|
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
# model
|
|
$this->load->model('web/m_news');
|
|
$this->load->model('web/m_review_log');
|
|
|
|
# log select
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['content_idx'] = $idx;
|
|
|
|
$result = $this->m_review_log->review_log_where_member_id_content_idx_select($req_data);
|
|
|
|
$is_insert = 'N';
|
|
if(count($result) > 0) {
|
|
$this->m_review_log->review_log_delete($result['idx']);
|
|
|
|
$delete_type = $type;
|
|
if($result['review_type'] != $type) {
|
|
$is_insert = 'Y';
|
|
$delete_type = $result['review_type'];
|
|
}
|
|
|
|
# 뉴스 카운트도 -1
|
|
$req_data = array();
|
|
$req_data['type'] = $delete_type;
|
|
$req_data['idx'] = $idx;
|
|
$req_data['value'] = -1;
|
|
|
|
$this->m_news->news_review_update($req_data);
|
|
|
|
} else {
|
|
$is_insert = 'Y';
|
|
}
|
|
|
|
if($is_insert == 'Y') {
|
|
# log insert
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['review_type'] = $type;
|
|
$req_data['content_idx'] = $idx;
|
|
|
|
$this->m_review_log->review_log_insert($req_data);
|
|
|
|
# news update
|
|
$req_data = array();
|
|
$req_data['type'] = $type;
|
|
$req_data['idx'] = $idx;
|
|
$req_data['value'] = 1;
|
|
|
|
$this->m_news->news_review_update($req_data);
|
|
|
|
}
|
|
|
|
# news select
|
|
$result = $this->m_news->news_select($idx);
|
|
|
|
if(count($result) > 0) {
|
|
$return_data['result'] = array('result_code' => '0000', 'result_data' => $result);
|
|
} else {
|
|
$return_data['result'] = array('result_code' => '9999');
|
|
}
|
|
|
|
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 북마크
|
|
# CREATE : 2018-04-17
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_bookmark_proc() {
|
|
# request
|
|
$content_idx = trim($this->input->get_post('content_idx', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
# model
|
|
$this->load->model('web/m_bookmark');
|
|
$result = $this->m_bookmark->bookmark_member_id_content_idx_select($req_data);
|
|
if(count($result) > 0) {
|
|
$idx = $result['idx'];
|
|
$result = $this->m_bookmark->bookmark_delete($idx);
|
|
$bookmark_status = 'off';
|
|
} else {
|
|
$result = $this->m_bookmark->bookmark_insert($req_data);
|
|
$bookmark_status = 'on';
|
|
}
|
|
|
|
$req_data = array();
|
|
$req_data['bookmark_status'] = $bookmark_status;
|
|
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000', 'data'=>$req_data);
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 좋아요~
|
|
# CREATE : 2018-04-16
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_like_proc() {
|
|
# request
|
|
$content_idx = trim($this->input->get_post('content_idx', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
if(empty($SES_MEMBER_ID)) return null;
|
|
|
|
# model
|
|
$this->load->model('web/m_like_log');
|
|
|
|
# log select
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
$result = $this->m_like_log->like_log_where_member_id_content_idx_count($req_data);
|
|
|
|
if(count($result) > 0) {
|
|
$this->m_like_log->like_log_delete($result['idx']);
|
|
|
|
$value = -1;
|
|
|
|
} else {
|
|
# log insert
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
$this->m_like_log->like_log_insert($req_data);
|
|
|
|
$value = 1;
|
|
}
|
|
|
|
# 각 글 카운트도 -1
|
|
$req_data = array();
|
|
$req_data['idx'] = $content_idx;
|
|
$req_data['value'] = $value;
|
|
|
|
if($content_type == '2') {
|
|
$this->load->model('web/m_column');
|
|
$this->m_column->column_like_count_update($req_data);
|
|
|
|
} else if($content_type == '3') {
|
|
$this->load->model('web/m_life');
|
|
$this->m_life->life_like_count_update($req_data);
|
|
}
|
|
|
|
|
|
# count
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['idx'] = $content_idx;
|
|
$this->load->model('web/m_vw_content');
|
|
$result = $this->m_vw_content->vw_content_select($req_data);
|
|
|
|
|
|
if(count($result) > 0) {
|
|
$return_data['result'] = array('result_code' => '0000', 'result_data' => $result);
|
|
} else {
|
|
$return_data['result'] = array('result_code' => '9999');
|
|
}
|
|
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 소셜 회원 정보
|
|
# CREATE : 2018-04-21
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_social_member_info() {
|
|
# request
|
|
$social_id = trim($this->input->get_post('social_id', TRUE));
|
|
|
|
# model
|
|
$this->load->model('web/m_tmp_social_member');
|
|
$result = $this->m_tmp_social_member->tmp_social_member_select($social_id);
|
|
|
|
if(count($result) > 0) {
|
|
$return_data['result'] = array('result_code' => '0000', 'result_data' => $result);
|
|
} else {
|
|
$return_data['result'] = array('result_code' => '9999');
|
|
}
|
|
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 트위터 회원인증
|
|
# CREATE : 2018-04-23
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_twitter_request_token() {
|
|
# request
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
|
|
$callback_url = WWW_CROSSMAP.'/web/share/twitter_callback_proc?type='.$type;
|
|
require_once (APPPATH."/inc/twitter_OAuth.php");
|
|
$tmhOAuth = new tmhOAuth();
|
|
|
|
$code = $tmhOAuth->apponly_request(array(
|
|
'without_bearer' => true,
|
|
'method' => 'POST',
|
|
'url' => $tmhOAuth->url('oauth/request_token', ''),
|
|
'params' => array(
|
|
'oauth_callback' => $callback_url
|
|
),
|
|
));
|
|
|
|
if ($code != 200) {
|
|
$return_data['result'] = array('result_code' => '9999');
|
|
} else {
|
|
|
|
$oauth = $tmhOAuth->extract_params($tmhOAuth->response['response']);
|
|
|
|
$twitter_oauth_token = $oauth['oauth_token'];
|
|
$twitter_oauth_token_secret = $oauth['oauth_token_secret'];
|
|
|
|
# 세션저장
|
|
$this->session->set_userdata('Twitter_Oauth_Token', $twitter_oauth_token);
|
|
$this->session->set_userdata('Twitter_Oauth_Token_Secret', $twitter_oauth_token_secret);
|
|
|
|
if($type=='login') {
|
|
$url = $tmhOAuth->url('oauth/authenticate', '') . "?oauth_token=".$twitter_oauth_token;
|
|
|
|
} else {
|
|
$url = $tmhOAuth->url('oauth/authorize', '') . "?oauth_token=".$twitter_oauth_token;
|
|
}
|
|
|
|
|
|
$result = array();
|
|
$result['url'] = $url;
|
|
|
|
$return_data['result'] = array('result_code' => '0000', 'result_data' => $result);
|
|
|
|
|
|
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 댓글 등록
|
|
# CREATE : 2018-04-23
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_comment_add_proc() {
|
|
# request
|
|
$content_idx = trim($this->input->get_post('content_idx', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
$comment = trim($this->input->get_post('comment', TRUE));
|
|
$p_idx = trim($this->input->get_post('p_idx', TRUE));
|
|
|
|
$this->load->helper('cookie');
|
|
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
|
|
$comment_sns_name = get_cookie('crossmap_comment_sns_name');
|
|
$comment_sns_type = get_cookie('crossmap_comment_sns_type');
|
|
|
|
|
|
if($comment_sns_id !='') {
|
|
# 게시물 열람 불가 체크
|
|
$req_data = array();
|
|
$req_data['member_id'] = $comment_sns_id;
|
|
$req_data['limit_type'] = '1';
|
|
|
|
# model
|
|
$this->load->model('web/m_blind_limit');
|
|
$arr_blind = $this->m_blind_limit->blind_limit_where_member_id_limit_type_select($req_data);
|
|
if(count($arr_blind) > 0) {
|
|
$def_arr_blind_limit_type = array('경고메일발송', '댓글작성불가', '게시물열람불가', '불량회원등록', '회원영구탈퇴');
|
|
$msg = "블라인드 누적으로 인해 기능이 제한 되었습니다.\r\n제제내용 : ".$def_arr_blind_limit_type[$arr_blind['limit_type']]."\n제제기간 : ".$arr_blind['end_date']." 까지";
|
|
|
|
throw new Cm_Exception('json', '9999', $msg);
|
|
|
|
}
|
|
}
|
|
|
|
# 금칙어
|
|
$this->load->model('web/m_forbidden_word');
|
|
$arr_forbidden_word = $this->m_forbidden_word->forbidden_word_list();
|
|
$count = 0; $i=0;
|
|
foreach ($arr_forbidden_word as $val) {
|
|
$spam_word = $val['word'];
|
|
if (stristr(strtolower($comment), $spam_word) != null) {
|
|
$count++;
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
if($count > 0) throw new Cm_Exception('json', '9999', '등록할수 없는 단어가 있습니다.');
|
|
|
|
# 언제 마지막으로 글을 썼는지 체크
|
|
// 1분전에 쓴글이 있으면 안댐
|
|
$reg_date = date("Y-m-d H:i:s", strtotime("-1 minutes"));
|
|
|
|
$req_data = array();
|
|
$req_data['write_id'] = $comment_sns_id;
|
|
$req_data['comment_sns_type'] = $comment_sns_type;
|
|
$req_data['reg_date'] = $reg_date;
|
|
|
|
$this->load->model('web/m_comment');
|
|
// $last_write_count = $this->m_comment->comment_where_reg_date_count($req_data);
|
|
// if($last_write_count > 0) {
|
|
// throw new Cm_Exception('json', '9999', '1분이내 연속 등록하실수 없습니다.');
|
|
// }
|
|
|
|
|
|
$now_date = date("Y-m-d H:i:s");
|
|
|
|
# max_idx 구하기
|
|
$req_data = array();
|
|
if($p_idx=='') {
|
|
$result = $this->m_comment->comment_max_idx_select();
|
|
$idx = $result['max_idx'];
|
|
if($idx == '') $idx = '1';
|
|
|
|
$p_idx = $idx;
|
|
$s_idx = 1;
|
|
$req_data['idx'] = $idx;
|
|
|
|
} else {
|
|
$result = $this->m_comment->comment_max_s_idx_select($p_idx);
|
|
$s_idx = $result['max_s_idx'];
|
|
}
|
|
|
|
$req_data['p_idx'] = $p_idx;
|
|
$req_data['s_idx'] = $s_idx;
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$req_data['comment'] = $comment;
|
|
$req_data['write_id'] = $comment_sns_id;
|
|
$req_data['write_name'] = $comment_sns_name;
|
|
$req_data['sns_name'] = $comment_sns_type;
|
|
$req_data['reg_date'] = $now_date;
|
|
$req_data['update_id'] = $comment_sns_id;
|
|
$req_data['update_date'] = $now_date;
|
|
$req_data['comment_status'] = '1';
|
|
$req_data['is_del'] = 'N';
|
|
|
|
$result = $this->m_comment->comment_insert($req_data);
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000');
|
|
|
|
if($content_type == '1') {
|
|
$this->load->model('web/m_news');
|
|
$this->m_news->news_comment_count_update($content_idx);
|
|
} else if($content_type == '2') {
|
|
$this->load->model('web/m_column');
|
|
$this->m_column->column_comment_count_update($content_idx);
|
|
} else if($content_type == '3') {
|
|
$this->load->model('web/m_life');
|
|
$this->m_life->life_comment_count_update($content_idx);
|
|
}
|
|
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999', 'msg'=>'댓글등록에 실패했습니다.');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 댓글 리스트
|
|
# CREATE : 2018-04-27
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_comment_list() {
|
|
# request
|
|
$sort = trim($this->input->get_post('sort', TRUE));
|
|
$page = trim($this->input->get_post('page', TRUE));
|
|
$content_idx = trim($this->input->get_post('content_idx', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
$is_comment_all_list = trim($this->input->get_post('is_comment_all_list', TRUE));
|
|
|
|
switch ($sort) {
|
|
case '4': $sort_column = 'reply_count'; $sort_type = 'desc'; break;
|
|
case '3': $sort_column = 'reg_date'; $sort_type = 'asc'; break;
|
|
case '2': $sort_column = 'reg_date'; $sort_type = 'desc'; break;
|
|
case '1': $sort_column = 'like_count'; $sort_type = 'desc'; break;
|
|
default : $sort_column = 'reg_date'; $sort_type = 'desc'; break;
|
|
}
|
|
|
|
if($page == '') $page = 1;
|
|
if($page == 1) {
|
|
$limit = 15;
|
|
$offset = 0;
|
|
} else {
|
|
$limit = 15;
|
|
$offset = ($page-1) * $limit;
|
|
}
|
|
|
|
$this->load->helper('cookie');
|
|
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
|
|
$comment_sns_name = get_cookie('crossmap_comment_sns_name');
|
|
$comment_sns_type = get_cookie('crossmap_comment_sns_type');
|
|
|
|
# 댓글
|
|
$this->load->model('web/m_comment');
|
|
|
|
# 총댓글수
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$total_count = $this->m_comment->comment_parent_where_content_idx_count($req_data);
|
|
|
|
# 댓글 리스트
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$req_data['offset'] = $offset;
|
|
$req_data['limit'] = $limit;
|
|
$req_data['sort_column'] = $sort_column;
|
|
$req_data['sort_type'] = $sort_type;
|
|
|
|
# list
|
|
$arr_comment = $this->m_comment->comment_parent_list($req_data);
|
|
|
|
|
|
$more_list = 'N';
|
|
if(($total_count-($page*$limit)) > 0){
|
|
$more_list = 'Y';
|
|
}
|
|
|
|
if(count($arr_comment) > 0) {
|
|
$return_data['result_code'] = '0000';
|
|
$return_data['comment_sns_id'] = $comment_sns_id;
|
|
$return_data['comment_sns_name'] = $comment_sns_name;
|
|
$return_data['comment_sns_type'] = $comment_sns_type;
|
|
$return_data['total_count'] = $total_count;
|
|
$return_data['arr_comment'] = $arr_comment;
|
|
$return_data['more_list'] = $more_list;
|
|
$return_data['is_comment_all_list'] = $is_comment_all_list;
|
|
|
|
} else {
|
|
$return_data['result_code'] = '9999';
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/comment_list', $return_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 대댓글 리스트
|
|
# CREATE : 2018-04-16
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_comment_reply_list() {
|
|
# request
|
|
$p_idx = trim($this->input->get_post('comment_idx', TRUE));
|
|
$page = trim($this->input->get_post('page', TRUE));
|
|
$sort = trim($this->input->get_post('sort', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
|
|
switch ($sort) {
|
|
case '4': $sort_column = 'like_count'; $sort_type = 'desc'; break;
|
|
case '3': $sort_column = 'reg_date'; $sort_type = 'asc'; break;
|
|
case '2': $sort_column = 'reg_date'; $sort_type = 'desc'; break;
|
|
case '1': $sort_column = 'like_count'; $sort_type = 'desc'; break;
|
|
default : $sort_column = 'reg_date'; $sort_type = 'desc'; break;
|
|
}
|
|
|
|
# paging 설정
|
|
if($page == '') $page = 1;
|
|
$limit = 20;
|
|
if($type == 'user_comment') $limit = 50;
|
|
$offset = ($page-1) * $limit;
|
|
|
|
# 검색
|
|
$req_data = array();
|
|
$req_data['p_idx'] = $p_idx;
|
|
$req_data['sort_column'] = $sort_column;
|
|
$req_data['sort_type'] = $sort_type;
|
|
$req_data['offset'] = $offset;
|
|
$req_data['limit'] = $limit;
|
|
|
|
# model - list
|
|
$this->load->model('web/m_comment');
|
|
|
|
# 총댓글수
|
|
$total_count = $this->m_comment->comment_where_p_idx_count($p_idx);
|
|
$arr_comment = $this->m_comment->comment_child_list($req_data);
|
|
|
|
$more_list = 'N';
|
|
if(($total_count-($page*$limit)) > 0){
|
|
$more_list = 'Y';
|
|
}
|
|
|
|
# view data
|
|
$return_data = array();
|
|
$return_data['result_code'] = '0000';
|
|
$return_data['total_count'] = $total_count;
|
|
$return_data['arr_comment'] = $arr_comment;
|
|
$return_data['more_list'] = $more_list;
|
|
|
|
# view
|
|
if($type == 'user_comment') {
|
|
return $this->load->view('/web/comm/user_comment_reply_list', $return_data);
|
|
} else {
|
|
return $this->load->view('/web/comm/comment_reply_list', $return_data);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 댓글 좋아요
|
|
# CREATE : 2018-04-27
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_comment_like_proc() {
|
|
# request
|
|
$comment_idx = trim($this->input->get_post('comment_idx', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
$this->load->helper('cookie');
|
|
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
|
|
|
|
|
|
if($type=='1') {
|
|
$type_name = 'like_count';
|
|
} else {
|
|
$type_name = 'bad_count';
|
|
}
|
|
|
|
# model
|
|
$this->load->model('web/m_comment_like_log');
|
|
$this->load->model('web/m_comment');
|
|
|
|
# log select
|
|
$req_data = array();
|
|
$req_data['member_id'] = $comment_sns_id;
|
|
$req_data['comment_idx'] = $comment_idx;
|
|
|
|
$result = $this->m_comment_like_log->comment_like_log_where_member_id_comment_idx_select($req_data);
|
|
$is_insert = 'N';
|
|
if(count($result) > 0) {
|
|
$this->m_comment_like_log->comment_like_log_delete($result['idx']);
|
|
$req_data = array();
|
|
$req_data['type_name'] = $result['type_name'];
|
|
$req_data['value'] = -1;
|
|
$req_data['idx'] = $comment_idx;
|
|
$this->m_comment->comemnt_like_bad_update($req_data);
|
|
|
|
if($result['type_name'] != $type_name) {
|
|
$is_insert = 'Y';
|
|
|
|
}
|
|
} else {
|
|
$is_insert = 'Y';
|
|
}
|
|
|
|
|
|
if($is_insert=='Y') {
|
|
// insert
|
|
$req_data = array();
|
|
$req_data['member_id'] = $comment_sns_id;
|
|
$req_data['type_name'] = $type_name;
|
|
$req_data['comment_idx'] = $comment_idx;
|
|
|
|
$this->m_comment_like_log->comment_like_log_insert($req_data);
|
|
|
|
|
|
$req_data = array();
|
|
$req_data['type_name'] = $type_name;
|
|
$req_data['value'] = 1;
|
|
$req_data['idx'] = $comment_idx;
|
|
$this->m_comment->comemnt_like_bad_update($req_data);
|
|
|
|
}
|
|
|
|
# select
|
|
$result = $this->m_comment->comment_select($comment_idx);
|
|
|
|
|
|
if(count($result) > 0) {
|
|
$return_data['result'] = array('code' => '0000', 'data' => $result);
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 신고
|
|
# CREATE : 2018-04-27
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_comment_spam_proc() {
|
|
# request
|
|
$comment_idx = trim($this->input->get_post('comment_idx', TRUE));
|
|
$spam_reason_content = trim($this->input->get_post('spam_reason_content', TRUE));
|
|
$spam_reason_type = trim($this->input->get_post('spam_reason_type', TRUE));
|
|
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
$SES_MEMBER_NAME = $this->session->userdata('C_Member_Name');
|
|
|
|
|
|
# select
|
|
$this->load->model('web/m_comment');
|
|
$result = $this->m_comment->comment_select($comment_idx);
|
|
if(count($result)==0){
|
|
throw new Cm_Exception('json', '9999', '신고에 실패했습니다.');
|
|
exit;
|
|
}
|
|
|
|
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['comment_idx'] = $comment_idx;
|
|
|
|
$this->load->model('web/m_spam');
|
|
$count = $this->m_spam->spam_where_member_id_comment_idx_count($req_data);
|
|
|
|
if($count > 0) throw new Cm_Exception('json', '9999', '이미 신고한 글입니다.');
|
|
|
|
|
|
$now_date = date("Y-m-d H:i:s");
|
|
|
|
$req_data = array();
|
|
$req_data['reason_type'] = $spam_reason_type;
|
|
$req_data['reason_content'] = $spam_reason_content;
|
|
$req_data['content_type'] = $result['content_type'];
|
|
$req_data['content_idx'] = $result['content_idx'];
|
|
$req_data['comment_idx'] = $comment_idx;
|
|
$req_data['spam_id'] = $result['write_id'];
|
|
$req_data['spam_name'] = $result['write_name'];
|
|
$req_data['spam_comment'] = $result['comment'];
|
|
$req_data['write_id'] = $SES_MEMBER_ID;
|
|
$req_data['write_name'] = $SES_MEMBER_NAME;
|
|
$req_data['reg_id'] = $SES_MEMBER_ID;
|
|
$req_data['reg_date'] = $now_date;
|
|
|
|
|
|
$result = $this->m_spam->spam_insert($req_data);
|
|
|
|
|
|
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000');
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999', 'msg'=>'신고에 실패했습니다.');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 칼럼 배달
|
|
# CREATE : 2018-04-28
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_delivery_proc() {
|
|
# request
|
|
$main_idx = trim($this->input->get_post('main_idx', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if($SES_MEMBER_ID=='') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
# model
|
|
$this->load->model('web/m_delivery');
|
|
|
|
$req_data = array();
|
|
$req_data['main_idx'] = $main_idx;
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
$now_date = date("Y-m-d H:i:s");
|
|
$result = $this->m_delivery->delivery_where_member_id_main_idx_select($req_data);
|
|
if(count($result) > 0) {
|
|
$req_data = array();
|
|
$req_data['is_del'] = 'Y';
|
|
$req_data['del_date'] = $now_date;
|
|
$req_data['idx'] = $result['idx'];
|
|
$this->m_delivery->delivery_update($req_data);
|
|
|
|
$delivery_status = 'off';
|
|
|
|
} else {
|
|
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['main_idx'] = $main_idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['reg_date'] = $now_date;
|
|
|
|
$this->m_delivery->delivery_insert($req_data);
|
|
|
|
$delivery_status = 'on';
|
|
|
|
}
|
|
|
|
$return_data['result'] = array('code' => '0000', 'data' => $delivery_status);
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 날씨정보가져오기
|
|
# CREATE : 2018-04-28
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_weather_view() {
|
|
# request
|
|
$lat = trim($this->input->get_post('latitude', TRUE));
|
|
$lon = trim($this->input->get_post('longitude', TRUE));
|
|
|
|
$client_id = 'cNiinVHYsygxVKF4FOtw';
|
|
$client_secret = 'nrTOCTFNUq';
|
|
$url = "https://openapi.naver.com/v1/map/reversegeocode?query=".$lon.",".$lat;
|
|
|
|
$ch1 = curl_init();
|
|
curl_setopt($ch1, CURLOPT_URL, $url);
|
|
curl_setopt($ch1, CURLOPT_POST, false);
|
|
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$headers = array();
|
|
$headers[] = "Content-Type: plain/text";
|
|
$headers[] = "X-Naver-Client-Id: ".$client_id;
|
|
$headers[] = "X-Naver-Client-Secret: ".$client_secret;
|
|
curl_setopt($ch1, CURLOPT_HTTPHEADER, $headers);
|
|
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, 0);
|
|
$response = curl_exec ($ch1);
|
|
$status_code = curl_getinfo($ch1, CURLINFO_HTTP_CODE);
|
|
curl_close ($ch1);
|
|
|
|
$location = '';
|
|
if($status_code=='200') {
|
|
$result = json_decode($response, true);
|
|
if(isset($result['result']['items'][0]['addrdetail'])==true){
|
|
$location = $result['result']['items'][0]['addrdetail']['sido'].' '.$result['result']['items'][0]['addrdetail']['sigugun'];
|
|
}
|
|
}
|
|
|
|
if($location!='') {
|
|
$url = 'https://apis.sktelecom.com/v1/weather/status?latitude='.$lat.'&longitude='.$lon;
|
|
$ch = curl_init(); //curl 사용 전 초기화 필수(curl handle)
|
|
curl_setopt($ch, CURLOPT_URL, $url); //URL 지정하기
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json', 'TDCProjectKey: 5cceabfc-f5a3-4a1c-a2c6-3e98e72c90bd')); //header 지정하기
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
|
$response = curl_exec ($ch);
|
|
if($response!='') {
|
|
$result = json_decode($response, true);
|
|
|
|
if(isset($result['weatherStatusCode'])==true){
|
|
switch ($result['weatherModifyCode']) {
|
|
case '0': $temperatures = '한파'; break;
|
|
case '1': $temperatures = '추움'; break;
|
|
case '2': $temperatures = '쌀쌀'; break;
|
|
case '3': $temperatures = '포근'; break;
|
|
case '4': $temperatures = '따뜻'; break;
|
|
case '5': $temperatures = '선선'; break;
|
|
case '6': $temperatures = '더움'; break;
|
|
case '7': $temperatures = '폭염'; break;
|
|
default : $temperatures = ''; break;
|
|
}
|
|
|
|
if($result['weatherStatusDescription']=='알수없음') $result['weatherStatusDescription'] = '-';
|
|
$weather_img = '/img/web/pweather_icon_'.$result['weatherStatusCode'].'.png';
|
|
|
|
|
|
$arr_public_weather = array('weather_img'=>$weather_img, 'weather_status'=>$result['weatherStatusDescription'], 'temperatures'=>$temperatures);
|
|
}
|
|
|
|
}
|
|
curl_close($ch);
|
|
|
|
}
|
|
|
|
if(count($arr_public_weather) > 0) {
|
|
$arr_public_weather['location'] = $location;
|
|
$return_data['result'] = array('code' => '0000', 'data' => $arr_public_weather);
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 북마크 url로 등록
|
|
# CREATE : 2018-05-05
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_bookmark_url_add_proc() {
|
|
# request
|
|
$bookmark_url = trim($this->input->get_post('bookmark_url', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
$bookmark_url = str_replace('http://', '', $bookmark_url);
|
|
$bookmark_url = str_replace('https://', '', $bookmark_url);
|
|
|
|
# url 체크 (뉴스, 칼럼, 라이프)
|
|
$content_type = ''; $content_idx = '';
|
|
$arr_valid_chk_url = array('1'=>$_SERVER['HTTP_HOST'].'/web/news/news_view/', '2'=>$_SERVER['HTTP_HOST'].'/web/news/column_view/', '3'=>$_SERVER['HTTP_HOST'].'/web/life/life_view/');
|
|
foreach ($arr_valid_chk_url as $key=>$val) {
|
|
if(strpos($bookmark_url, $val) !== FALSE){
|
|
$content_type = $key;
|
|
$content_idx = str_replace($val, '', $bookmark_url);
|
|
}
|
|
}
|
|
if($content_type=='' || $content_idx=='') throw new Cm_Exception('json', '9999', '북마크 할수 없는 url입니다.');
|
|
|
|
# 북마크
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['content_idx'] = $content_idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
# model
|
|
$this->load->model('web/m_bookmark');
|
|
$result = $this->m_bookmark->bookmark_member_id_content_idx_select($req_data);
|
|
if(count($result) > 0) {
|
|
throw new Cm_Exception('json', '9999', '이미 북마크되어 있는 url입니다.');
|
|
} else {
|
|
$result = $this->m_bookmark->bookmark_insert($req_data);
|
|
}
|
|
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000');
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 북마크 삭제
|
|
# CREATE : 2018-05-05
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_bookmark_del_proc() {
|
|
# request
|
|
$idx = trim($this->input->get_post('idx', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
|
|
# 북마크
|
|
$req_data = array();
|
|
$req_data['idx'] = $idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
# model
|
|
$this->load->model('web/m_bookmark');
|
|
$count = $this->m_bookmark->bookmark_member_id_idx_count($req_data);
|
|
if($count == 0) {
|
|
throw new Cm_Exception('json', '9999', '삭제할수 없는 북마크입니다.');
|
|
} else {
|
|
$result = $this->m_bookmark->bookmark_delete($idx);
|
|
}
|
|
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000');
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 북마크 복수 삭제
|
|
# CREATE : 2018-05-05
|
|
#---------------------------------------------------------------------------
|
|
function fn_bookmark_arr_del_proc() {
|
|
# request
|
|
$arr_idx = $this->input->get_post('is_del', TRUE); // 삭제할 idx
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
# model
|
|
$this->load->model('web/m_bookmark');
|
|
|
|
foreach ($arr_idx as $val) {
|
|
# 북마크
|
|
$req_data = array();
|
|
$req_data['idx'] = $val;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$count = $this->m_bookmark->bookmark_member_id_idx_count($req_data);
|
|
if($count > 0) {
|
|
# model - delete
|
|
$this->m_bookmark->bookmark_delete($val);
|
|
}
|
|
}
|
|
|
|
gf_alert("삭제되었습니다.", '/web/mypage/bookmark');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 배달함 삭제
|
|
# CREATE : 2018-05-07
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_delivery_del_proc() {
|
|
# request
|
|
$idx = trim($this->input->get_post('idx', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
# model
|
|
$this->load->model('web/m_delivery');
|
|
|
|
$req_data = array();
|
|
$req_data['idx'] = $idx;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$count = $this->m_delivery->delivery_member_id_idx_count($req_data);
|
|
|
|
if($count == 0) {
|
|
throw new Cm_Exception('json', '9999', '삭제할수 없는 배달함입니다.');
|
|
} else {
|
|
$req_data = array();
|
|
$req_data['idx'] = $idx;
|
|
$req_data['del_date'] = date("Y-m-d H:i:s");
|
|
$req_data['is_del'] = 'Y';
|
|
$result = $this->m_delivery->delivery_is_del_update($req_data);
|
|
}
|
|
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000');
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 배달함 배열 삭제
|
|
# CREATE : 2018-05-07
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_delivery_arr_del_proc() {
|
|
# request
|
|
$arr_idx = $this->input->get_post('idxs', TRUE);
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
# model
|
|
$this->load->model('web/m_delivery');
|
|
|
|
$now_date = date("Y-m-d H:i:s");
|
|
foreach ($arr_idx as $val) {
|
|
$req_data = array();
|
|
$req_data['idx'] = $val;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$count = $this->m_delivery->delivery_member_id_idx_count($req_data);
|
|
if($count > 0) {
|
|
$req_data = array();
|
|
$req_data['idx'] = $val;
|
|
$req_data['del_date'] = $now_date;
|
|
$req_data['is_del'] = 'Y';
|
|
|
|
$this->m_delivery->delivery_is_del_update($req_data);
|
|
}
|
|
}
|
|
|
|
$return_data = array();
|
|
$return_data['result'] = array('code' => '0000');
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : delivery list
|
|
# CREATE : 2018-05-07
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_delivery_list() {
|
|
# request
|
|
$page = trim($this->input->get_post('page', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
|
|
$limit = 15;
|
|
$offset = ($page-1) * $limit;
|
|
|
|
|
|
$this->load->model('web/m_delivery');
|
|
|
|
|
|
|
|
# 채널
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['offset'] = $offset;
|
|
$req_data['limit'] = $limit;
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
|
|
if($content_type == '2') {
|
|
# model
|
|
$list = $this->m_delivery->delivery_join_partner_list($req_data);
|
|
$total_count = $this->m_delivery->delivery_join_partner_list_total_count($req_data);
|
|
|
|
} else if($content_type == '3') {
|
|
# model
|
|
$list = $this->m_delivery->delivery_join_channel_list($req_data);
|
|
$total_count = $this->m_delivery->delivery_join_channel_list_total_count($req_data);
|
|
} else if($content_type == '9') {
|
|
# model
|
|
$list = $this->m_delivery->delivery_join_tag_list($req_data);
|
|
$total_count = $this->m_delivery->delivery_join_tag_list_total_count($req_data);
|
|
}
|
|
|
|
|
|
|
|
$more_list = 'N';
|
|
if(($total_count-($page*$limit)) > 0){
|
|
$more_list = 'Y';
|
|
}
|
|
|
|
|
|
$return_data['result_code'] = '0000';
|
|
$return_data['total_count'] = $total_count;
|
|
$return_data['list'] = $list;
|
|
$return_data['more_list'] = $more_list;
|
|
|
|
|
|
# view
|
|
return $this->load->view("/web/comm/delivery_list", $return_data);
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : user_comment list
|
|
# CREATE : 2018-05-08
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_user_comment_list() {
|
|
# request
|
|
$page = trim($this->input->get_post('page', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
$write_id = trim($this->input->get_post('write_id', TRUE));
|
|
$sort = trim($this->input->get_post('sort', TRUE));
|
|
|
|
switch ($sort) {
|
|
case '4': $sort_column = 'reply_count'; $sort_type = 'desc'; break;
|
|
case '3': $sort_column = 'reg_date'; $sort_type = 'asc'; break;
|
|
case '2': $sort_column = 'reg_date'; $sort_type = 'desc'; break;
|
|
case '1': $sort_column = 'like_count'; $sort_type = 'desc'; break;
|
|
default : $sort_column = 'reg_date'; $sort_type = 'desc'; break;
|
|
}
|
|
|
|
$this->load->helper('cookie');
|
|
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
|
|
|
|
|
|
$limit = 15;
|
|
$offset = ($page-1) * $limit;
|
|
|
|
$is_comment_view = 'N';
|
|
if($comment_sns_id != '') {
|
|
if($content_type =='3') {
|
|
if($write_id==$comment_sns_id) $is_comment_view = 'Y';
|
|
} else {
|
|
$is_comment_view = 'Y';
|
|
}
|
|
}
|
|
|
|
$total_count = 0;
|
|
$list = array();
|
|
if($is_comment_view == 'Y') {
|
|
# 댓글
|
|
$this->load->model('web/m_comment');
|
|
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['write_id'] = $write_id;
|
|
|
|
# 총댓글수 + 답글
|
|
$total_count = $this->m_comment->comment_join_vw_content_where_write_id_list_count($req_data);
|
|
|
|
# 댓글 리스트
|
|
$req_data = array();
|
|
$req_data['content_type'] = $content_type;
|
|
$req_data['offset'] = $offset;
|
|
$req_data['limit'] = $limit;
|
|
$req_data['sort_column'] = $sort_column;
|
|
$req_data['sort_type'] = $sort_type;
|
|
$req_data['write_id'] = $write_id;
|
|
|
|
# list
|
|
$list = $this->m_comment->comment_join_vw_content_where_write_id_list($req_data);
|
|
}
|
|
|
|
|
|
|
|
$more_list = 'N';
|
|
if(($total_count-($page*$limit)) > 0){
|
|
$more_list = 'Y';
|
|
}
|
|
|
|
$return_data = array();
|
|
$return_data['result_code'] = '0000';
|
|
$return_data['total_count'] = $total_count;
|
|
$return_data['list'] = $list;
|
|
$return_data['more_list'] = $more_list;
|
|
|
|
|
|
# view
|
|
return $this->load->view("/web/comm/user_comment_list", $return_data);
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 댓글 삭제
|
|
# CREATE : 2018-05-07
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_user_comment_del_proc() {
|
|
# request
|
|
$idx = trim($this->input->get_post('idx', TRUE));
|
|
|
|
$this->load->helper('cookie');
|
|
$comment_sns_id = get_cookie('crossmap_comment_sns_id');
|
|
if($comment_sns_id == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
|
|
# model
|
|
$this->load->model('web/m_comment');
|
|
$this->load->model('web/m_comment_setting');
|
|
|
|
|
|
$req_data = array();
|
|
$req_data['idx'] = $idx;
|
|
$req_data['write_id'] = $comment_sns_id;
|
|
$arr_comment = $this->m_comment->comment_member_id_idx_select($req_data);
|
|
|
|
if(count($arr_comment) == 0) {
|
|
throw new Cm_Exception('json', '9999', '삭제할수 없는 댓글입니다.');
|
|
} else {
|
|
|
|
$content_type = $arr_comment['content_type'];
|
|
$comment_org = $arr_comment['comment'];
|
|
|
|
$arr_setting = $this->m_comment_setting->comment_setting_where_content_idx_select($content_type);
|
|
|
|
$comment = '작성자에 의해 삭제된 댓글입니다.';
|
|
if(isset($arr_setting['self_del_contnet'])==true) {
|
|
$comment = $arr_setting['self_del_contnet'];
|
|
}
|
|
|
|
$req_data = array();
|
|
$req_data['idx'] = $idx;
|
|
$req_data['comment'] = $comment;
|
|
$req_data['comment_org'] = $comment_org;
|
|
$req_data['del_date'] = date("Y-m-d H:i:s");
|
|
$req_data['is_del'] = 'Y';
|
|
$req_data['comment_status'] = '4';
|
|
|
|
$result = $this->m_comment->comment_is_del_update($req_data);
|
|
}
|
|
|
|
if($result) {
|
|
$return_data['result'] = array('code' => '0000');
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999');
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 이메일 보내기
|
|
# CREATE : 2018-05-07
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_send_email_content() {
|
|
# request
|
|
$content_idx = trim($this->input->get_post('content_idx', TRUE));
|
|
$content_type = trim($this->input->get_post('content_type', TRUE));
|
|
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
$SES_MEMBER_NAME = $this->session->userdata('C_Member_Name');
|
|
$SES_MEMBER_EMAIL = $this->session->userdata('C_Member_Email');
|
|
|
|
if($SES_MEMBER_ID == '') throw new Cm_Exception('json', '9999', '회원로그인 후에 가능합니다.');
|
|
if($SES_MEMBER_EMAIL == '') throw new Cm_Exception('json', '9999', '등록되어 있는 이메일이 없습니다.');
|
|
|
|
|
|
if($content_type == '1') { // 뉴스
|
|
$this->load->model('web/m_news');
|
|
$result = $this->m_news->news_select($content_idx);
|
|
|
|
} else if($content_type == '2') { // 칼럼
|
|
$this->load->model('web/m_column');
|
|
$result = $this->m_column->column_select($content_idx);
|
|
}
|
|
|
|
$title = ''; $content = '';
|
|
if(count($result) > 0){
|
|
$title = $result['title'];
|
|
$content = $result['content'];
|
|
}
|
|
|
|
if($content == '') throw new Cm_Exception('json', '9999', '기사 내용이 없습니다.');
|
|
|
|
|
|
$content = $content.'<p></p><p> </p>P.S) 하나님의 은혜와 평강이 '.$SES_MEMBER_NAME.'님의 삶 가운데 늘 가득하기를 크로스맵이 응원하고 기도합니다!<p></p><p> </p>- 크로스맵 일동 올림 -';
|
|
|
|
$mail_result['content'] = $content;
|
|
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
|
|
|
|
$this->load->library('email');
|
|
$config = array();
|
|
$config['wordwrap'] = true;
|
|
$config['mailtype'] = 'html';
|
|
$this->email->initialize($config);
|
|
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
|
|
$this->email->to($SES_MEMBER_EMAIL);
|
|
$this->email->subject('Fwd: '.$title);
|
|
$this->email->message($message);;
|
|
$this->email->send();
|
|
|
|
|
|
$return_data['result'] = array('code' => '0000');
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : popup
|
|
# CREATE : 2018-05-08
|
|
#---------------------------------------------------------------------------
|
|
function fn_nonskin_popup_body() {
|
|
# request
|
|
$idx = $this->input->get_post('idx', TRUE);
|
|
|
|
$this->load->model('web/m_popup');
|
|
$result = $this->m_popup->popup_select($idx);
|
|
if(count($result) > 0){
|
|
$view_url = '/web/comm/popup_body';
|
|
} else {
|
|
$view_url = '/web/comm/result_html';
|
|
$result = '잘못된 접근입니다.';
|
|
}
|
|
|
|
# view
|
|
return $this->load->view($view_url, $result);
|
|
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : popup
|
|
# CREATE : 2018-05-08
|
|
#---------------------------------------------------------------------------
|
|
function fn_nonskin_kmc_mobile_auth() {
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/kmc_mobile_auth', '');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : kmc 암호화
|
|
# CREATE : 2018-05-08
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_kmc_encode_proc() {
|
|
# request
|
|
$mobile = trim($this->input->get_post('mobile', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
|
|
$mobile = str_replace('-', '', $mobile);
|
|
$cur_time = date('YmdHis');
|
|
$rand_no = rand(100000, 999999);
|
|
|
|
//요청 번호 생성
|
|
$cert_num = $cur_time.$rand_no;
|
|
|
|
|
|
$cpId = 'CRPM1001'; // 회원사ID
|
|
$urlCode = '001001'; // URL 코드
|
|
$certNum = $cert_num; // 요청번호
|
|
$date = $cur_time; // 요청일시
|
|
$certMet = 'M'; // 본인인증방법
|
|
$birthDay = ''; // 생년월일
|
|
$gender = ''; // 성별
|
|
$name = ''; // 성명
|
|
$phoneNo = $mobile; // 휴대폰번호
|
|
$phoneCorp = ''; // 이동통신사
|
|
$nation = ''; // 내외국인 구분
|
|
$plusInfo = $type; // 추가DATA정보
|
|
$extendVar = "0000000000000000"; // 확장변수
|
|
|
|
$name = str_replace(" ", "+", $name) ; //성명에 space가 들어가는 경우 "+"로 치환하여 암호화 처리
|
|
|
|
// 02. tr_cert 데이터변수 조합 (서버로 전송할 데이터 "/"로 조합)
|
|
$tr_cert = $cpId . "/" . $urlCode . "/" . $certNum . "/" . $date . "/" . $certMet . "/" . $birthDay . "/" . $gender . "/" . $name . "/" . $phoneNo . "/" . $phoneCorp . "/" . $nation . "/" . $plusInfo . "/" . $extendVar;
|
|
|
|
|
|
//암호화모듈 호출
|
|
$enc_tr_cert = '';
|
|
if (extension_loaded('ICERTSecu')) {
|
|
//03. 1차암호화
|
|
$enc_tr_cert = ICertSeed(1,0,'',$tr_cert);
|
|
|
|
//04. 변조검증값 생성
|
|
$enc_tr_cert_hash = ICertHMac($enc_tr_cert);
|
|
|
|
//05. 2차암호화
|
|
$enc_tr_cert = $enc_tr_cert . "/" . $enc_tr_cert_hash . "/" . "0000000000000000";
|
|
|
|
$enc_tr_cert = ICertSeed(1,0,'',$enc_tr_cert);
|
|
|
|
}
|
|
|
|
if($enc_tr_cert == '') {
|
|
$return_data['result'] = array('code' => '9999');
|
|
} else {
|
|
$return_data['result'] = array('code' => '0000', 'data' => $enc_tr_cert);
|
|
|
|
}
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : popup
|
|
# CREATE : 2018-05-08
|
|
#---------------------------------------------------------------------------
|
|
function fn_nonskin_kmc_callback_proc() {
|
|
# request
|
|
$rec_cert = trim($this->input->get_post('rec_cert', TRUE));
|
|
$certNum = trim($this->input->get_post('certNum', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
|
|
if(strlen($rec_cert) == 0 || strlen($certNum) == 0){
|
|
gf_alert('본인인증에 실패했습니다.', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
$iv = $certNum;
|
|
|
|
//암호화모듈 호출
|
|
if (extension_loaded('ICERTSecu')) {
|
|
//01.인증결과 1차 복호화
|
|
$rec_cert = ICertSeed(2,0,$iv,$rec_cert);
|
|
|
|
|
|
//02.복호화 데이터 Split (rec_cert 1차암호화데이터 / 위변조 검증값 / 암복화확장변수)
|
|
$decStr_Split = explode("/", $rec_cert);
|
|
|
|
$encPara = $decStr_Split[0]; //rec_cert 1차 암호화데이터
|
|
$encMsg = $decStr_Split[1]; //위변조 검증값
|
|
|
|
//03.인증결과 2차 복호화
|
|
$rec_cert = ICertSeed(2,0,$iv,$encPara);
|
|
|
|
//04. 복호화 된 결과자료 "/"로 Split 하기
|
|
$decStr_Split = explode("/", $rec_cert);
|
|
|
|
$certNum = $decStr_Split[0];
|
|
$date = $decStr_Split[1];
|
|
$CI = $decStr_Split[2];
|
|
$phoneNo = $decStr_Split[3];
|
|
$phoneCorp = $decStr_Split[4];
|
|
$birthDay = $decStr_Split[5];
|
|
$gender = $decStr_Split[6];
|
|
$nation = $decStr_Split[7];
|
|
$name = $decStr_Split[8];
|
|
$result = $decStr_Split[9];
|
|
$certMet = $decStr_Split[10];
|
|
$ip = $decStr_Split[11];
|
|
$M_name = $decStr_Split[12];
|
|
$M_birthDay = $decStr_Split[13];
|
|
$M_Gender = $decStr_Split[14];
|
|
$M_nation = $decStr_Split[15];
|
|
$plusInfo = $decStr_Split[16];
|
|
$DI = $decStr_Split[17];
|
|
|
|
//05. CI,DI 복호화
|
|
if(strlen($CI) > 0) $CI = ICertSeed(2,0,$iv,$CI);
|
|
if(strlen($DI) > 0) $DI = ICertSeed(2,0,$iv,$DI);
|
|
|
|
|
|
function paramChk($pattern, $param){
|
|
$result = preg_match($pattern, $param);
|
|
return $result;
|
|
}
|
|
|
|
// 요청번호 (최대 40byte까지 유효)
|
|
if(strlen($certNum) > 40 || strlen($certNum) == 0){
|
|
gf_alert('요청번호 비정상', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
// 요청일시 (숫자 14자리만 유효)
|
|
$patn = "/^[0-9]*$/";
|
|
if(strlen($date) != 14 || paramchk($patn, $date) == 0){
|
|
gf_alert('휴대폰번호 비정상', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
// 휴대폰번호 (값이 있는 경우에는 숫자 10 또는 11자리까지만 유효)
|
|
$patn = "/^[0-9]*$/";
|
|
if((strlen($phoneNo) != 10 && strlen($phoneNo) != 11) || paramChk($patn, $phoneNo) == 0){
|
|
gf_alert('휴대폰번호 비정상', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
}else{
|
|
gf_alert('본인인증에 실패했습니다.', 'self_close');
|
|
exit;
|
|
}
|
|
|
|
$this->load->model('web/m_member');
|
|
if($plusInfo=='member_join1') {
|
|
$result = $this->m_member->member_where_mobile_CI_select($CI);
|
|
if(count($result) > 0) {
|
|
gf_alert('이미 가입되어있는 번호입니다.', 'self_close');
|
|
exit;
|
|
|
|
}
|
|
} else if($plusInfo=='member_join2') { // 14세 미만
|
|
$result = $this->m_member->member_where_parent_CI_select($CI);
|
|
if(count($result) > 0) {
|
|
gf_alert('이미 가입되어있는 부모님 번호입니다.', 'self_close');
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
} else if($plusInfo=='email_check') {
|
|
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['CI'] = $CI;
|
|
$count = $this->m_member->member_where_mobile_CI_member_id_count($req_data);
|
|
if($count == 0){
|
|
gf_alert('본인명의의 휴대폰 번호가 아닙니다.', 'self_close');
|
|
exit;
|
|
}
|
|
} else if($plusInfo=='member_edit') {
|
|
$req_data = array();
|
|
$req_data['member_id'] = $SES_MEMBER_ID;
|
|
$req_data['CI'] = $CI;
|
|
$count = $this->m_member->member_where_mobile_CI_member_id_count($req_data);
|
|
if($count == 0){
|
|
gf_alert('본인명의의 휴대폰 번호로만 변경가능합니다.', 'self_close');
|
|
exit;
|
|
}
|
|
}
|
|
|
|
$name = iconv("EUC-KR","UTF-8", $name);
|
|
|
|
$return_data = array();
|
|
$return_data['CI'] = $CI;
|
|
$return_data['type'] = $plusInfo;
|
|
$return_data['name'] = $name;
|
|
$return_data['phone'] = $phoneNo;
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/kmc_mobile_auth_fin', $return_data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 이메일로 찾기
|
|
# CREATE : 2018-05-30
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_find_by_email_proc() {
|
|
# request
|
|
$content = trim($this->input->get_post('content', TRUE));
|
|
$email = trim($this->input->get_post('email', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
|
$this->load->model('web/m_member');
|
|
if($type=='id') {
|
|
$req_data = array();
|
|
$req_data['member_name'] = $content;
|
|
$req_data['member_email'] = $email;
|
|
|
|
|
|
$count = $this->m_member->member_where_email_name_count($req_data);
|
|
if($count>0) {
|
|
// 인증번호 생성
|
|
$rand_num = gf_generate_random_string(6);
|
|
$req_data = array();
|
|
$req_data['type'] = $type;
|
|
$req_data['content'] = $content;
|
|
$req_data['type_key'] = $email;
|
|
$req_data['auth_key'] = $rand_num;
|
|
$req_data['reg_id'] = 'system';
|
|
$req_data['reg_date'] = date("Y-m-d H:i:s");
|
|
|
|
$this->load->model('web/m_tmp_find_key');
|
|
$this->m_tmp_find_key->tmp_find_key_insert($req_data);
|
|
|
|
|
|
// 이메일발송
|
|
$content1 ='소중한 ID 정보를 잊어버리셨군요; <p></p>';
|
|
$content1.='아래 인증번호로 인증처리 하시면 아이디를 확인하실 수 있습니다. <p></p><p> </p>';
|
|
$content1.='<b>인증번호</b>: '.$rand_num.'<p></p><p> </p>';
|
|
$content1.='* 소중한 개인정보, 잊어버리지 않도록 유의해 주세요. <p></p><p> </p>';
|
|
$content1.='P.S) 하나님의 은혜와 평강이 '.$content.'님의 삶 가운데 늘 가득하기를 <p></p>';
|
|
$content1.='크로스맵이 응원하고 기도합니다! <p></p><p> </p>';
|
|
$content1.=' - 크로스맵 일동 올림 - <p></p>';
|
|
|
|
$mail_result['content'] = $content1;
|
|
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
|
|
|
|
// $this->load->library('email');
|
|
// $config = array();
|
|
// $config['wordwrap'] = true;
|
|
// $config['mailtype'] = 'html';
|
|
// $this->email->initialize($config);
|
|
$this->load->library('email');
|
|
$config = array();
|
|
$config['wordwrap'] = true;
|
|
$config['mailtype'] = 'html';
|
|
$this->email->initialize($config);
|
|
$this->email->from(CROSSMAP_EMAIL_ID, CROSSMAP_EMAIL_NAME);
|
|
$this->email->to($email);
|
|
$this->email->subject('크로스맵 아이디찾기 인증메일입니다.');
|
|
$this->email->message($message);
|
|
|
|
if($this->email->send()){
|
|
//Success email Sent
|
|
$debug= "ok";
|
|
}else{
|
|
//Email Failed To Send
|
|
$debug= "o";
|
|
}
|
|
|
|
$return_data['result'] = array('code' => '0000','data'=>$content1);
|
|
|
|
} else {
|
|
$return_data['result'] = array('code' => '9999', 'msg' => '입력하신 정보가 없습니다.');
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 이메일로 찾기 - 인증
|
|
# CREATE : 2018-05-30
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_find_by_email_auth_proc() {
|
|
# request
|
|
$content = trim($this->input->get_post('content', TRUE));
|
|
$email = trim($this->input->get_post('email', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
$auth_key = trim($this->input->get_post('auth_key', TRUE));
|
|
|
|
|
|
$this->load->model('web/m_member');
|
|
if($type=='id') {
|
|
$this->load->model('web/m_tmp_find_key');
|
|
$req_data = array();
|
|
$req_data['type'] = $type;
|
|
$req_data['content'] = $content;
|
|
$req_data['type_key'] = $email;
|
|
$req_data['auth_key'] = $auth_key;
|
|
|
|
$count = $this->m_tmp_find_key->tmp_find_key_where_type_content_type_key_auth_key_count($req_data);
|
|
if($count==0){
|
|
throw new Cm_Exception('json', '9999', '인증에 실패했습니다.');
|
|
}
|
|
|
|
$req_data = array();
|
|
$req_data['member_name'] = $content;
|
|
$req_data['member_email'] = $email;
|
|
|
|
$result = $this->m_member->member_where_email_name_select_limit1($req_data);
|
|
$return_data['result'] = array('code' => '0000', 'data'=>$result['member_id']);
|
|
|
|
}
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 비밀번호 찾기
|
|
# CREATE : 2018-05-30
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_find_password_proc() {
|
|
# request
|
|
$key = trim($this->input->get_post('key', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
|
|
$this->load->model('web/m_member');
|
|
if($type=='mobile') {
|
|
$result = $this->m_member->member_where_mobile_CI_select($key);
|
|
|
|
} else if($type=='email') {
|
|
$id = trim($this->input->get_post('id', TRUE));
|
|
$req_data = array();
|
|
$req_data['member_id'] = $id;
|
|
$req_data['member_email'] = $key;
|
|
$result = $this->m_member->member_where_member_id_email_select($req_data);
|
|
|
|
|
|
}
|
|
|
|
if(count($result) == 0) throw new Cm_Exception('json', '9999', '일치하는 회원정보가 없습니다.');
|
|
|
|
$member_email = $result['member_email'];
|
|
if($member_email=='') throw new Cm_Exception('json', '9999', '이메일이 등록되어있지 않습니다. 관리자에게 문의해주세요.');
|
|
|
|
|
|
// 임시비밀번호 생성
|
|
$rand_num = gf_generate_random_string(8);
|
|
|
|
$req_data = array();
|
|
$req_data['member_pwd'] = MD5($rand_num);
|
|
$req_data['idx'] = $result['idx'];
|
|
$result = $this->m_member->member_update($req_data);
|
|
|
|
// 이메일발송
|
|
$content='소중한 비밀번호 정보를 잊어버리셨군요.<p></p><p> </p>';
|
|
$content.='<b>임시 비밀번호</b>: <span style="color:#44cbd2;">'.$rand_num.'</span><p></p><p> </p>';
|
|
$content.='꼭! 보안수준이 높은 비밀번호로 재변경하시기 바랍니다.<p></p>';
|
|
$content.='* 소중한 개인정보, 잊어버리지 않도록 유의해 주세요.<p></p><p> </p>';
|
|
$content.='P.S) 하나님의 은혜와 평강이 '.$result['member_name'].'님의 삶 가운데 늘 가득하기를<p></p>';
|
|
$content.='크로스맵이 응원하고 기도합니다! <p></p><p> </p>';
|
|
$content.=' - 크로스맵 일동 올림 - <p></p>';
|
|
|
|
$mail_result['content'] = $content;
|
|
$message = $this->load->view('/web/comm/mail_template', $mail_result, TRUE);
|
|
|
|
|
|
$this->load->library('email');
|
|
$config = array();
|
|
$config['wordwrap'] = true;
|
|
$config['mailtype'] = 'html';
|
|
$this->email->initialize($config);
|
|
$this->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
|
|
$this->email->to($member_email);
|
|
$this->email->subject('크로스맵 비밀번호 찾기 임시 비밀번호 안내 메일입니다.');
|
|
$this->email->message($message);
|
|
|
|
$this->email->send();
|
|
|
|
$dd = print_r($this->email,true);
|
|
|
|
|
|
$arr_email = explode("@", $member_email);
|
|
|
|
$email1 = mb_substr($arr_email[0], 0, 1).'**'.mb_substr($arr_email[0], 3, 1).'***';
|
|
$email2 = mb_substr($arr_email[1], 0, 1).'******';
|
|
|
|
$member_email = $email1.'@'.$email2;
|
|
|
|
|
|
$return_data['result'] = array('code' => '0000', 'data' => $member_email , 'debug'=>$dd);
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 아이디 찾기
|
|
# CREATE : 2018-05-30
|
|
#---------------------------------------------------------------------------
|
|
function fn_ajax_find_id_proc() {
|
|
# request
|
|
$key = trim($this->input->get_post('key', TRUE));
|
|
$type = trim($this->input->get_post('type', TRUE));
|
|
|
|
if($type=='mobile') {
|
|
$this->load->model('web/m_member');
|
|
$result = $this->m_member->member_where_mobile_CI_select($key);
|
|
|
|
}
|
|
|
|
if(count($result) == 0) throw new Cm_Exception('json', '9999', '등록되어있는 회원이 아닙니다.');
|
|
|
|
$member_id = $result['member_id'];
|
|
|
|
$return_data['result'] = array('code' => '0000', 'data' => $member_id);
|
|
|
|
|
|
# view
|
|
return $this->load->view('/web/comm/result_json', $return_data);
|
|
|
|
}
|
|
|
|
#---------------------------------------------------------------------------
|
|
# PURPOSE : 댓글 로그아웃
|
|
# CREATE : 2018-05-30
|
|
#---------------------------------------------------------------------------
|
|
function fn_comment_logout() {
|
|
$this->load->helper('cookie');
|
|
set_cookie('crossmap_save_login', 'N', 86400 * 90);
|
|
set_cookie('crossmap_save_id', '', 86400 * 90);
|
|
set_cookie('crossmap_comment_sns_id', '', 86400 * 90);
|
|
set_cookie('crossmap_comment_sns_name', '', 86400 * 90);
|
|
set_cookie('crossmap_comment_sns_type', '', 86400 * 90);
|
|
gf_alert('로그아웃되었습니다.', $_SERVER['HTTP_REFERER']);
|
|
|
|
}
|
|
} |