first commit
This commit is contained in:
75
application/libraries/Advertisement_lib.php
Executable file
75
application/libraries/Advertisement_lib.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Advertisement_lib {
|
||||
var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
|
||||
var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름
|
||||
var $file_cache_path = '';
|
||||
var $CI = null;
|
||||
|
||||
public function __construct($params) {
|
||||
if(isset($params['file_cache_path'])==TRUE && $params['file_cache_path']!='') {
|
||||
$this->file_cache_path = $params['file_cache_path'];
|
||||
}
|
||||
$this->CI = &get_instance();
|
||||
}
|
||||
|
||||
|
||||
public function create_ad_cache(){
|
||||
$this->CI->load->database();
|
||||
$query = $this->CI->db->query("SELECT a.idx, b.page_key, b.ad_pos_key, a.ad_option, a.ad_code, a.ad_file,a.ad_lending FROM $this->ad_code_tb_name AS a JOIN $this->ad_page_tb_name AS b ON a.ad_idx = b.idx");
|
||||
$i=array();
|
||||
foreach($query->result_array() as $v){
|
||||
$i[$v['page_key']][$v['ad_pos_key']]=array('option'=>$v['ad_option'],'ad_code'=>$v['ad_code'],'ad_file'=>$v['ad_file'],'ad_lending'=>$v['ad_lending']);
|
||||
}
|
||||
$json_data=json_encode($i);
|
||||
|
||||
if($json_data!=FALSE) {
|
||||
$this->write_ad_cache($json_data);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
write advertisement cache file
|
||||
@param (string) advertisement data
|
||||
@return (boolean)
|
||||
*/
|
||||
public function write_ad_cache($json_data) {
|
||||
$this->CI->load->helper('file');
|
||||
$fname = $this->get_ad_cache_name();
|
||||
if($fname!='') {
|
||||
return write_file($fname, $json_data, 'w');
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_ad_data($page_key){
|
||||
$data=$this->get_ad_cache();
|
||||
$data=json_decode($data,TRUE);
|
||||
if(isset($data[$page_key])){
|
||||
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_ad_cache() {
|
||||
$this->CI->load->helper('file');
|
||||
$fname = $this->get_ad_cache_name();
|
||||
if($fname!='') {
|
||||
return read_file($fname);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
get category cache file name
|
||||
@param (numeric) maptoon category table idx
|
||||
@return (string | null)
|
||||
*/
|
||||
public function get_ad_cache_name() {
|
||||
$fname = $this->file_cache_path.'advertisement';
|
||||
return $fname;
|
||||
}
|
||||
}
|
||||
47
application/libraries/Awsfileuploader.php
Executable file
47
application/libraries/Awsfileuploader.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require APPPATH . 'third_party/aws/autoloader.php';
|
||||
|
||||
use Aws\S3\S3Client;
|
||||
|
||||
class Awsfileuploader
|
||||
{
|
||||
|
||||
private $CI;
|
||||
private $bucket = 'cm-img';
|
||||
private $accessKey = 'AKIA2WGASVZ5TQZDCANX';
|
||||
private $secretAccessKey = 'QJ1SiYxeSSr19pjp9igaUcm9y7FU5WVOrXzqX4Ap';
|
||||
private $s3;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->CI = &get_instance();
|
||||
$this->CI->load->helper('string');
|
||||
$credentials = new Aws\Credentials\Credentials($this->accessKey, $this->secretAccessKey);
|
||||
$this->s3 = new S3Client(array(
|
||||
'version' => 'latest',
|
||||
'region' => 'ap-northeast-2',
|
||||
'credentials' => $credentials,
|
||||
'scheme' => 'http',
|
||||
));
|
||||
}
|
||||
|
||||
public function upload($filePath, $keyPath)
|
||||
{
|
||||
$result = $this->s3->putObject(array(
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $keyPath,
|
||||
'Body' => fopen($filePath, 'r'),
|
||||
'ACL' => 'public-read',
|
||||
));
|
||||
@unlink($filePath);
|
||||
return '/'. $keyPath;
|
||||
}
|
||||
|
||||
public function delete($keyPath) {
|
||||
$result = $this->s3->deleteObject(array(
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $keyPath
|
||||
));
|
||||
}
|
||||
}
|
||||
84
application/libraries/CM_Pagination.php
Executable file
84
application/libraries/CM_Pagination.php
Executable file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
/**
|
||||
* CodeIgniter
|
||||
*
|
||||
* An open source application development framework for PHP
|
||||
*
|
||||
* This content is released under the MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 - 2015, British Columbia Institute of Technology
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @author EllisLab Dev Team
|
||||
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
|
||||
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
|
||||
* @license http://opensource.org/licenses/MIT MIT License
|
||||
* @link http://codeigniter.com
|
||||
* @since Version 1.0.0
|
||||
* @filesource
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Pagination Class
|
||||
*
|
||||
* @package CodeIgniter
|
||||
* @subpackage Libraries
|
||||
* @category Pagination
|
||||
* @author EllisLab Dev Team
|
||||
* @link http://codeigniter.com/user_guide/libraries/pagination.html
|
||||
*/
|
||||
class CM_Pagination extends CI_Pagination
|
||||
{
|
||||
|
||||
public $num_links = 5;
|
||||
public $cur_page = 1;
|
||||
public $use_page_numbers = true;
|
||||
public $first_link = '<span aria-hidden="true">«</span>';
|
||||
public $next_link = '<span aria-hidden="true">></span>';
|
||||
public $prev_link = '<span aria-hidden="true"><</span>';
|
||||
public $last_link = '<span aria-hidden="true">»</span>';
|
||||
public $first_tag_open = '<li>';
|
||||
public $first_tag_close = '</li>';
|
||||
public $last_tag_open = '<li>';
|
||||
public $last_tag_close = '</li>';
|
||||
public $cur_tag_open = '<li class="active"><a>';
|
||||
public $cur_tag_close = '</a></li>';
|
||||
public $next_tag_open = '<li>';
|
||||
public $next_tag_close = '</li>';
|
||||
public $prev_tag_open = '<li>';
|
||||
public $prev_tag_close = '</li>';
|
||||
public $full_tag_open = '<ul class="pagination">';
|
||||
public $full_tag_close = '</ul>';
|
||||
public $num_tag_open = '<li>';
|
||||
public $num_tag_close = '</li>';
|
||||
public $page_query_string = true;
|
||||
public $query_string_segment = 'page';
|
||||
|
||||
protected $reuse_query_string = true;
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
530
application/libraries/Comm.php
Executable file
530
application/libraries/Comm.php
Executable file
@@ -0,0 +1,530 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Comm
|
||||
{
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 로그인
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_login_proc($req_data){
|
||||
$ci=& get_instance();
|
||||
$ci->load->helper('cookie');
|
||||
$ci->load->library('session');
|
||||
|
||||
# 회원정보
|
||||
$idx = $req_data['idx'];
|
||||
$member_name = $req_data['member_name'];
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
$member_nickname = $req_data['member_nickname'];
|
||||
$member_intro = $req_data['member_intro'];
|
||||
$member_img = $req_data['member_img'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_email = $req_data['member_email'];
|
||||
if($member_nickname == '') $member_nickname = $member_name;
|
||||
|
||||
$save_login = 'N';
|
||||
if(isset($req_data['save_login'])==true) {
|
||||
$save_login = $req_data['save_login'];
|
||||
}
|
||||
|
||||
# 마지막 로그인 정보 업데이트
|
||||
$ci->m_member->member_visit_count_last_login_update($idx);
|
||||
|
||||
# 로그인 로그 남기기
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
# model
|
||||
$ci->load->model('web/m_member_login_log');
|
||||
$ci->m_member_login_log->member_login_log_insert($req_data);
|
||||
|
||||
# model
|
||||
$ci->load->model('web/m_member_group');
|
||||
$arr_member_group = $ci->m_member_group->member_group_select($member_group_idx);
|
||||
$member_group_name = '';
|
||||
if(isset($arr_member_group['member_group_name'])==true){
|
||||
$member_group_name = $arr_member_group['member_group_name'];
|
||||
}
|
||||
|
||||
$session_id = $ci->session->session_id;
|
||||
|
||||
|
||||
# 세션저장
|
||||
$ci->session->set_userdata('C_Member_Name', $member_name);
|
||||
$ci->session->set_userdata('C_Member_Id', $member_id);
|
||||
$ci->session->set_userdata('C_Member_Nicname', $member_nickname);
|
||||
$ci->session->set_userdata('C_Member_Group', $member_group_idx);
|
||||
$ci->session->set_userdata('C_Member_Group_Name', $member_group_name);
|
||||
$ci->session->set_userdata('C_Member_Intro', $member_intro);
|
||||
$ci->session->set_userdata('C_Member_Profile', $member_img);
|
||||
$ci->session->set_userdata('C_Member_Email', $member_email);
|
||||
|
||||
set_cookie('crossmap_save_login', $save_login, 86400 * 90);
|
||||
if($save_login=='Y') {
|
||||
set_cookie('crossmap_save_id', $session_id, 86400 * 90);
|
||||
} else {
|
||||
set_cookie('crossmap_save_id', '', 86400 * 90);
|
||||
}
|
||||
|
||||
set_cookie('crossmap_comment_sns_id', $member_id, 0);
|
||||
set_cookie('crossmap_comment_sns_name', $member_nickname, 0);
|
||||
set_cookie('crossmap_comment_sns_type', 'cm', 0);
|
||||
|
||||
|
||||
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
|
||||
|
||||
# model
|
||||
$msg = '';
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ci->load->model('web/m_member_login');
|
||||
$member_login_count = $ci->m_member_login->member_login_member_id_count($req_data);
|
||||
if($member_login_count > 0){
|
||||
$msg = '현재 동시접속중인 사용자가 있습니다.';
|
||||
$ci->m_member_login->member_login_delete($req_data);
|
||||
|
||||
}
|
||||
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
$req_data['expire_date'] = $expire_date;
|
||||
$ci->m_member_login->member_login_insert($req_data);
|
||||
|
||||
|
||||
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 로그아웃
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_logout_proc(){
|
||||
$ci=& get_instance();
|
||||
$ci->load->helper('cookie');
|
||||
$ci->load->library('session');
|
||||
|
||||
|
||||
$member_id = $ci->session->userdata('C_Member_Id');
|
||||
|
||||
|
||||
# 세션정보 unset
|
||||
$ci->session->unset_userdata('C_Member_Name');
|
||||
$ci->session->unset_userdata('C_Member_Id');
|
||||
$ci->session->unset_userdata('C_Member_Nicname');
|
||||
$ci->session->unset_userdata('C_Member_Group');
|
||||
$ci->session->unset_userdata('C_Member_Group_Name');
|
||||
$ci->session->unset_userdata('C_Member_Intro');
|
||||
$ci->session->unset_userdata('C_Member_Profile');
|
||||
$ci->session->unset_userdata('C_Member_Email');
|
||||
|
||||
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);
|
||||
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ci->load->model('web/m_member_login');
|
||||
$ci->m_member_login->member_login_delete($req_data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : hit_count update
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_hit_count_update($req_data){
|
||||
$ci=& get_instance();
|
||||
|
||||
$reg_date = date("Y-m-d H:i:s", strtotime("-1 hours"));
|
||||
|
||||
if($req_data['member_id']=='') $req_data['member_id'] = '';
|
||||
|
||||
$ci->load->model('web/m_hit_log');
|
||||
$count = 0;
|
||||
if($req_data['member_id'] !='') {
|
||||
$req_data1 = array();
|
||||
$req_data1['reg_date'] = $reg_date;
|
||||
$req_data1['content_type'] = $req_data['content_type'];
|
||||
$req_data1['content_idx'] = $req_data['content_idx'];
|
||||
$req_data1['member_id'] = $req_data['member_id'];
|
||||
|
||||
$count = $ci->m_hit_log->hit_log_where_member_id_content_idx_count($req_data1);
|
||||
}
|
||||
|
||||
if($count==0) {
|
||||
$ci->m_hit_log->hit_log_insert($req_data);
|
||||
|
||||
$content_type = $req_data['content_type'];
|
||||
$idx = $req_data['content_idx'];
|
||||
|
||||
# 각 글 hit+1
|
||||
if($content_type == '3') {
|
||||
$ci->load->model('web/m_life');
|
||||
$ci->m_life->life_hit_count_update($idx);
|
||||
|
||||
} else if($content_type == '2') {
|
||||
$ci->load->model('web/m_column');
|
||||
$ci->m_column->column_hit_count_update($idx);
|
||||
|
||||
} else if($content_type == '1') {
|
||||
$ci->load->model('web/m_news');
|
||||
$ci->m_news->news_hit_count_update($idx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 댓글 로그인
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_comment_login_proc($req_data){
|
||||
$ci=& get_instance();
|
||||
$ci->load->helper('cookie');
|
||||
|
||||
# 회원정보
|
||||
$member_name = $req_data['member_name'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$sns_type_name = $req_data['sns_type_name'];
|
||||
|
||||
set_cookie('crossmap_comment_sns_id', $member_id, 0);
|
||||
set_cookie('crossmap_comment_sns_name', $member_name, 0);
|
||||
set_cookie('crossmap_comment_sns_type', $sns_type_name, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 뉴스 footer
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_news_footer() {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$theme_types = array('3');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
$arr_recomm_news = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 3) $arr_recomm_news[$val['rank']] = $val;
|
||||
}
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$theme_types = array('6');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
$arr_m_recomm_news = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 6) $arr_m_recomm_news[$val['rank']] = $val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 실시간급상승
|
||||
$req_data = array();
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 20;
|
||||
|
||||
$ci->load->model('web/m_realtime_keyword');
|
||||
$arr_realtime_keyword = $ci->m_realtime_keyword->realtime_keyword_list($req_data);
|
||||
|
||||
|
||||
$news_footer = array();
|
||||
$news_footer['arr_recomm_news'] = $arr_recomm_news;
|
||||
$news_footer['arr_m_recomm_news'] = $arr_m_recomm_news;
|
||||
$news_footer['arr_realtime_keyword'] = $arr_realtime_keyword;
|
||||
|
||||
|
||||
return $news_footer;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 뉴스 right
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_news_right() {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
# 테마
|
||||
# 2: 주요뉴스 / 4: 오늘의포토 / 7: 헤드라인칼럼 / 8: 오늘의칼럼 / 9:추천연재 / 15: 추천라이프
|
||||
$theme_types = array('2','4','7','8','9','15');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
|
||||
$arr_main_news = array();
|
||||
$arr_today_photo = array();
|
||||
$arr_headline_column = array();
|
||||
$arr_today_column = array();
|
||||
$arr_recomm_column = array();
|
||||
$arr_recomm_life = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 2) $arr_main_news[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 4) $arr_today_photo[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 7) $arr_headline_column[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'column_name'=> $val['column_name'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'partner_idx' => $val['partner_idx'], 'content' => $val['content']);
|
||||
if($val['theme_type'] == 8) $arr_today_column[$val['rank']] = array('title' => $val['title'], 'column_name'=> $val['column_name'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 9) $arr_recomm_column[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'column_name'=> $val['column_name'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'partner_idx' => $val['partner_idx']);
|
||||
if($val['theme_type'] == 15) $arr_recomm_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
|
||||
}
|
||||
|
||||
$ci->load->model('life_model');
|
||||
$qnaCategoryPosts = $ci->life_model->findByCategoryId(34)->order_by('l.reg_date', 'desc')->limit(2)->get()->result();
|
||||
foreach($qnaCategoryPosts as $k=>$post) {
|
||||
$arr_recomm_column[$k+1] = array('rank'=>$k+1, 'title' => $post->title, 'column_name'=> $post->editorIntro,
|
||||
'theme_img' => $post->mainImg, 'content_idx' => $post->idx, 'partner_idx' => $post->editorId);
|
||||
}
|
||||
|
||||
# 기타섹션 - 인기영상 1 / 인기포토 2
|
||||
// $ci->load->model('web/m_etc_section');
|
||||
// $req_data = array();
|
||||
// $req_data['etc_section_types'] = array('1', '2');
|
||||
// $arr_etc_section = $ci->m_etc_section->etc_section_where_in_etc_section_type_list($req_data);
|
||||
|
||||
// $arr_p_photo = array();
|
||||
// $arr_p_video = array();
|
||||
// foreach ($arr_etc_section as $val) {
|
||||
// if($val['etc_section_type'] == 2) $arr_p_photo[$val['rank']] = array('content_type'=>$val['content_type'], 'head_title'=>$val['head_title'], 'title' => $val['title'], 'main_video' => $val['main_video'], 'video_url' => $val['video_url'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
|
||||
// if($val['etc_section_type'] == 1) $arr_p_video[$val['rank']] = array('content_type'=>$val['content_type'], 'head_title'=>$val['head_title'], 'title' => $val['title'], 'main_video' => $val['main_video'], 'video_url' => $val['video_url'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
|
||||
// }
|
||||
|
||||
$cmtvCategoryPosts = $ci->life_model->findByCategoryId(22)->order_by('l.reg_date', 'desc')->limit(2)->get()->result();
|
||||
$arr_p_video = array();
|
||||
foreach ($cmtvCategoryPosts as $k=>$post) {
|
||||
$arr_p_video[$k+1] = array('content_type'=>3, 'head_title'=>$post->head_title, 'title' => $post->title, 'main_img' => $post->mainImg, 'content_idx' => $post->idx);
|
||||
}
|
||||
|
||||
# 라이브인기글 --> 라이프 랭킹 - 많이본 TOP5
|
||||
// $req_data = array();
|
||||
// $req_data['ranking_type'] = '1';
|
||||
// $req_data['content_type'] = '3';
|
||||
// $req_data['offset'] = 0;
|
||||
// $req_data['limit'] = 50;
|
||||
// $ci->load->model('web/m_ranking');
|
||||
// $arr_life_ranking = $ci->m_ranking->ranking_join_life_list($req_data);
|
||||
|
||||
$arr_life_ranking = array();
|
||||
$qnaCategoryPosts = $ci->life_model->findByCategoryId()->order_by('l.hit_count', 'desc')->limit(10)->get()->result();
|
||||
foreach($qnaCategoryPosts as $k=>$post) {
|
||||
$arr_life_ranking[$k+1] = array('rank'=>$k+1, 'title' => $post->title, 'column_name'=> $post->editorIntro,
|
||||
'theme_img' => $post->mainImg, 'content_idx' => $post->idx, 'partner_idx' => $post->editorId);
|
||||
}
|
||||
|
||||
# 실시간급상승
|
||||
$req_data = array();
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 20;
|
||||
|
||||
$ci->load->model('web/m_realtime_keyword');
|
||||
$arr_realtime_keyword = $ci->m_realtime_keyword->realtime_keyword_list($req_data);
|
||||
|
||||
|
||||
$arr_news_right = array();
|
||||
$arr_news_right['arr_main_news'] = $arr_main_news;
|
||||
$arr_news_right['arr_today_photo'] = $arr_today_photo;
|
||||
$arr_news_right['arr_recomm_column'] = $arr_recomm_column;
|
||||
$arr_news_right['arr_recomm_life'] = $arr_recomm_life;
|
||||
$arr_news_right['arr_life_ranking'] = $arr_life_ranking;
|
||||
// $arr_news_right['arr_p_photo'] = $arr_p_photo;
|
||||
$arr_news_right['arr_p_video'] = $arr_p_video;
|
||||
$arr_news_right['arr_realtime_keyword'] = $arr_realtime_keyword;
|
||||
$arr_news_right['arr_headline_column'] = $arr_headline_column;
|
||||
$arr_news_right['arr_today_column'] = $arr_today_column;
|
||||
|
||||
return $arr_news_right;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 댓글
|
||||
# CREATE : 2018-04-29
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_comment($req_data) {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$sort_type = $req_data['sort_type'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
# 댓글
|
||||
$ci->load->model('web/m_comment');
|
||||
|
||||
# 총댓글수
|
||||
$req_data = array();
|
||||
$req_data['content_type'] = $content_type;
|
||||
$req_data['content_idx'] = $content_idx;
|
||||
$comment_total_count = $ci->m_comment->comment_parent_where_content_idx_count($req_data);
|
||||
|
||||
# 본인삭제 수
|
||||
$req_data['write_id'] = $write_id;
|
||||
$comment_my_delete_count = $ci->m_comment->comment_my_delete_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 = $ci->m_comment->comment_parent_list($req_data);
|
||||
|
||||
|
||||
$return_data = array();
|
||||
$return_data['comment_total_count'] = $comment_total_count;
|
||||
$return_data['comment_my_delete_count'] = $comment_my_delete_count;
|
||||
$return_data['arr_comment'] = $arr_comment;
|
||||
|
||||
return $return_data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 라이프 right
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_life_right_comm($theme_types) {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
# 테마
|
||||
# 13: 라이프 스타일, 14: 지금뜨는 라이프
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
|
||||
$arr_life_style = array();
|
||||
$arr_boomup_life = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 13) $arr_life_style[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 14) $arr_boomup_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
}
|
||||
|
||||
|
||||
# 라이프 공감글 --> 라이프 랭킹 - 공감많은 TOP3
|
||||
$req_data = array();
|
||||
$req_data['ranking_type'] = '3';
|
||||
$req_data['content_type'] = '3';
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 3;
|
||||
$ci->load->model('web/m_ranking');
|
||||
$arr_life_ranking = $ci->m_ranking->ranking_list($req_data);
|
||||
|
||||
|
||||
$arr_news_comm = array();
|
||||
$arr_news_comm['arr_life_style'] = $arr_life_style;
|
||||
$arr_news_comm['arr_boomup_life'] = $arr_boomup_life;
|
||||
$arr_news_comm['arr_life_ranking'] = $arr_life_ranking;
|
||||
|
||||
|
||||
return $arr_news_comm;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 맵툰 maptoon right
|
||||
# CREATE : 2019-03-26
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_mt_right() {
|
||||
$ci=& get_instance();
|
||||
|
||||
# 테마
|
||||
# 2: 주요뉴스 / 4: 오늘의포토 / 7: 헤드라인칼럼 / 8: 오늘의칼럼 / 9:추천연재 / 15: 추천라이프
|
||||
$theme_types = array('15');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
$arr_recomm_life = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 15) $arr_recomm_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'main_img' => $val['main_img']);
|
||||
}
|
||||
|
||||
|
||||
$ci->load->model('maptoon/m_maptoon');
|
||||
//맵툰 실시간 조회 순위
|
||||
$ep_view_rank = $ci->m_maptoon->get_ep_view_rank();
|
||||
//맵툰 인기 순위
|
||||
$mt_pop_rank = $ci->m_maptoon->get_mt_pop_rank();
|
||||
|
||||
$return_data['arr_recomm_life']=$arr_recomm_life;
|
||||
$return_data['arr_ep_view_rank']=$ep_view_rank;
|
||||
$return_data['arr_mt_pop_rank']=$mt_pop_rank;
|
||||
|
||||
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 금칙어 체크
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_forbidden_word($word) {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$ci->load->model('web/m_forbidden_word');
|
||||
$count = $ci->m_forbidden_word->forbidden_word_where_word_count($word);
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
384
application/libraries/Comm_admin.php
Executable file
384
application/libraries/Comm_admin.php
Executable file
@@ -0,0 +1,384 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Comm_admin
|
||||
{
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 테마 등록
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_theme_reg($req_data){
|
||||
# request
|
||||
$theme_type = $req_data['theme_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$rank = $req_data['rank'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
$filename = $req_data['filename'];
|
||||
$title = $req_data['title'];
|
||||
$is_display = $req_data['is_display'];
|
||||
|
||||
$head_title = '';
|
||||
if(isset($req_data['head_title']) == true) $head_title = $req_data['head_title'];
|
||||
|
||||
$sub_content = '';
|
||||
if(isset($req_data['sub_content']) == true) $sub_content = $req_data['sub_content'];
|
||||
|
||||
$is_file_copy = '';
|
||||
if(isset($req_data['is_file_copy']) == true) $is_file_copy = $req_data['is_file_copy'];
|
||||
|
||||
$sub_title = '';
|
||||
if(isset($req_data['sub_title']) == true) $sub_title = $req_data['sub_title'];
|
||||
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
if($filename!='' && $is_file_copy!='N') {
|
||||
# image upload
|
||||
$upload_path = './files/theme/' . date("Y") . "/" . date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, true);
|
||||
}
|
||||
$arr_new_file = explode('/', $filename);
|
||||
copy('.' . $filename, $upload_path . '/' . $theme_type .$rank. '_' . $arr_new_file[5]);
|
||||
$filename = '/files/theme/' . date("Y") . '/' . date("m") . '/' . $theme_type .$rank. '_' . $arr_new_file[5];
|
||||
}
|
||||
|
||||
|
||||
$req_data1 = array();
|
||||
$req_data1['theme_type'] = $theme_type;
|
||||
$req_data1['content_type'] = $content_type;
|
||||
$req_data1['rank'] = $rank;
|
||||
$req_data1['content_idx'] = $content_idx;
|
||||
|
||||
# model
|
||||
$ci->load->model('admin/comm/m_theme');
|
||||
$result = $ci->m_theme->theme_rank_content_idx_select($req_data1);
|
||||
|
||||
$arr_theme = array('theme_type' => $theme_type, 'content_type' => $content_type, 'rank' => $rank, 'title' => $title, 'head_title' => $head_title, 'sub_title' => $sub_title,'sub_content' => $sub_content, 'theme_img' => $filename, 'content_idx' => $content_idx, 'is_display' => $is_display);
|
||||
if(count($result)==0) {
|
||||
$req_data2 = array();
|
||||
$req_data2['theme_type'] = $theme_type;
|
||||
$req_data2['content_type'] = $content_type;
|
||||
$req_data2['rank'] = $rank;
|
||||
|
||||
$rank_count = $ci->m_theme->theme_rank_count($req_data);
|
||||
if ($rank_count > 0 && $is_display=='Y') {
|
||||
$result = $ci->m_theme->theme_rank_is_del_update($req_data);
|
||||
if (!$result) {
|
||||
return false;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$result = $ci->m_theme->theme_insert($arr_theme);
|
||||
|
||||
} else {
|
||||
$arr_theme['idx'] = $result[0]['idx'];
|
||||
$result = $ci->m_theme->theme_item_update($arr_theme);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 기타섹션 등록
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_etc_section_reg($req_data){
|
||||
# request
|
||||
$etc_section_type = $req_data['etc_section_type'];
|
||||
$content_type = $req_data['content_type'];
|
||||
$rank = $req_data['rank'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
$filename = $req_data['filename'];
|
||||
$title = $req_data['title'];
|
||||
$is_display = $req_data['is_display'];
|
||||
|
||||
$head_title = '';
|
||||
if(isset($req_data['head_title']) == true) $head_title = $req_data['head_title'];
|
||||
|
||||
|
||||
$is_file_copy = '';
|
||||
if(isset($req_data['is_file_copy']) == true) $is_file_copy = $req_data['is_file_copy'];
|
||||
|
||||
|
||||
$filename2 = '';
|
||||
if(isset($req_data['filename2']) == true) $filename2 = $req_data['filename2'];
|
||||
|
||||
|
||||
$video_url = '';
|
||||
if(isset($req_data['video_url']) == true) $video_url = $req_data['video_url'];
|
||||
|
||||
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
|
||||
if($filename!='' && $is_file_copy!='N') {
|
||||
# image upload
|
||||
$upload_path = './files/etc_section/'.date("Y")."/".date("m");
|
||||
if (!is_dir($upload_path)) {
|
||||
mkdir($upload_path, 0777, TRUE);
|
||||
}
|
||||
$arr_new_file = explode('/', $filename);
|
||||
copy('.' . $filename, $upload_path . '/' . $etc_section_type.$rank. '_' . $arr_new_file[5]);
|
||||
$filename = '/files/etc_section/'.date("Y").'/'.date("m").'/'.$etc_section_type.$rank.'_'.$arr_new_file[5];
|
||||
}
|
||||
|
||||
$req_data1 = array();
|
||||
$req_data1['etc_section_type'] = $etc_section_type;
|
||||
$req_data1['content_type'] = $content_type;
|
||||
$req_data1['rank'] = $rank;
|
||||
$req_data1['content_idx'] = $content_idx;
|
||||
|
||||
# model
|
||||
$ci->load->model('admin/etc_section/m_etc_section');
|
||||
$result = $ci->m_etc_section->etc_section_rank_content_idx_select($req_data1);
|
||||
|
||||
$arr_etc_section = array('etc_section_type'=> $etc_section_type
|
||||
, 'content_type'=> $content_type
|
||||
, 'rank'=> $rank
|
||||
, 'head_title'=>$head_title
|
||||
, 'title'=>$title
|
||||
, 'main_img'=>$filename
|
||||
, 'main_video'=>$filename2
|
||||
, 'video_url'=>$video_url
|
||||
, 'content_idx'=>$content_idx
|
||||
, 'is_display'=>$is_display);
|
||||
if(count($result)==0) {
|
||||
$req_data2 = array();
|
||||
$req_data2['etc_section_type'] = $etc_section_type;
|
||||
$req_data2['rank'] = $rank;
|
||||
|
||||
# model
|
||||
$ci->load->model('admin/etc_section/m_etc_section');
|
||||
$rank_count = $ci->m_etc_section->etc_section_rank_count($req_data);
|
||||
if($rank_count > 0 && $is_display == 'Y') {
|
||||
$result = $ci->m_etc_section->etc_section_rank_is_del_update($req_data);
|
||||
if(!$result) {
|
||||
return false;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$result = $ci->m_etc_section->etc_section_insert($arr_etc_section);
|
||||
|
||||
|
||||
} else {
|
||||
$arr_etc_section['idx'] = $result[0]['idx'];
|
||||
$result = $ci->m_etc_section->etc_section_update($arr_etc_section);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 페이징
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_pagination($req_data){
|
||||
# request
|
||||
$total_count= $req_data['total_count'];
|
||||
$limit = $req_data['limit'];
|
||||
$base_url = $req_data['base_url'];
|
||||
$suffix = $req_data['suffix'];
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$ci->load->library('pagination');
|
||||
$config['base_url'] = $base_url ;
|
||||
$config['total_rows'] = $total_count;
|
||||
$config['per_page'] = $limit;
|
||||
$config['uri_segment'] = 5;
|
||||
$config['num_links'] = 4;
|
||||
$config['use_page_numbers'] = TRUE;
|
||||
$config['suffix'] = $suffix;
|
||||
$config['first_link'] = '<i style="vertical-align:bottom" class="fa fa-2x fa-angle-double-left" style="margin:0;"></i>';
|
||||
$config['prev_link'] = '<i style="vertical-align:bottom" class="fa fa-2x fa-angle-left" style="margin:0;"></i>';
|
||||
$config['next_link'] = '<i style="vertical-align:bottom" class="fa fa-2x fa-angle-right" style="margin:0;"></i>';
|
||||
$config['last_link'] = '<i style="vertical-align:bottom" class="fa fa-2x fa-angle-double-right" style="margin:0;"></i>';
|
||||
$config['cur_tag_open'] = '<b class="curr">';
|
||||
$config['cur_tag_close'] = ' </b>';
|
||||
$config['num_tag_open'] = '<span>';
|
||||
$config['num_tag_close'] = ' </span>';
|
||||
|
||||
$ci->pagination->initialize($config);
|
||||
$pagination = $ci->pagination->create_links();
|
||||
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 블라인드 제재처리
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_blind_limit_proc($req_data){
|
||||
$ci=& get_instance();
|
||||
|
||||
# request
|
||||
$limit_content = $req_data['limit_content'];
|
||||
$limit_count = $req_data['limit_count'];
|
||||
$member_email = $req_data['member_email'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$limit_type = $req_data['limit_type'];
|
||||
$end_date = $req_data['end_date'];
|
||||
$member_name = $req_data['member_name'];
|
||||
|
||||
$def_arr_blind_limit_type = array('경고메일발송', '댓글작성불가', '게시물열람불가', '불량회원등록', '회원영구탈퇴');
|
||||
|
||||
$limit_content = str_replace('{{블라인드누적횟수}}', $limit_count, $limit_content);
|
||||
$limit_content = str_replace('{{제재내용}}', $def_arr_blind_limit_type[$limit_type], $limit_content);
|
||||
$limit_content = str_replace('{{제재만료일시}}', $end_date, $limit_content);
|
||||
|
||||
$ci->load->model('admin/member/m_member');
|
||||
|
||||
$req_data = array();
|
||||
if($limit_type == '3') { // 불량회원등록
|
||||
$req_data['member_group_idx'] = '3';
|
||||
$req_data['member_id'] = $member_id;
|
||||
$ci->m_member->member_where_member_id_update($req_data);
|
||||
} else if($limit_type == '4') { // 회원영구탈퇴
|
||||
$req_data['member_group_idx'] = '5';
|
||||
$req_data['member_status'] = '2';
|
||||
$req_data['member_id'] = $member_id;
|
||||
$ci->m_member->member_where_member_id_update($req_data);
|
||||
}
|
||||
|
||||
|
||||
$limit_content.='<p></p><p> </p>많은 사람들이 자유롭게 편히 쉴 수 있는 크리스천 놀이터, 크로스맵이 될 수 있도록 도움주시길 부탁 드립니다. <p></p><p> </p>';
|
||||
$limit_content.='P.S) 하나님의 은혜와 평강이 '.$member_name.'님의 삶 가운데 늘 가득하기를 <p></p>';
|
||||
$limit_content.='크로스맵이 응원하고 기도합니다! <p></p><p> </p>';
|
||||
$limit_content.=' - 크로스맵 일동 올림 - <p></p>';
|
||||
|
||||
$mail_result['content'] = $limit_content;
|
||||
$message = $ci->load->view('/web/comm/mail_template', $mail_result, TRUE);
|
||||
|
||||
// 경고메일발송
|
||||
$ci->load->library('email');
|
||||
$config = array();
|
||||
$config['wordwrap'] = true;
|
||||
$config['mailtype'] = 'html';
|
||||
$ci->email->initialize($config);
|
||||
$ci->email->from(CROSSMAP_EMAIL, CROSSMAP_EMAIL_NAME);
|
||||
$ci->email->to($member_email);
|
||||
$ci->email->subject('크로스맵에서 주의를 당부 드립니다.');
|
||||
$ci->email->message($message);
|
||||
|
||||
$ci->email->send();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 유투브 주소로 playtime 알아내기
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_youtube_playtime($youtube_id){
|
||||
|
||||
|
||||
$url = 'https://www.googleapis.com/youtube/v3/videos?id='.$youtube_id.'&key=AIzaSyBuZrx6ZUeeFuBFho6dU2vJB-b5CAyHrdQ&part=contentDetails';
|
||||
$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')); //header 지정하기
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
$response = curl_exec ($ch);
|
||||
$content_detail = json_decode($response, true);
|
||||
|
||||
$duration_txt='00:00';
|
||||
if(isset($content_detail['items'][0]['contentDetails']['duration'])==true){
|
||||
$duration = $content_detail['items'][0]['contentDetails']['duration'];
|
||||
$d = new DateInterval($duration);
|
||||
if($d->format('%H')=='00'){
|
||||
$duration_txt = $d->format('%I:%S');
|
||||
} else {
|
||||
$duration_txt = $d->format('%H:%I:%S');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $duration_txt;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 테마 노출로 변경
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_theme_change_is_display($req_data){
|
||||
# request
|
||||
$content_type = $req_data['content_type'];
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$ci->load->model('admin/comm/m_theme');
|
||||
$result2 = $ci->m_theme->theme_content_idx_list($req_data);
|
||||
if(count($result2) > 0) {
|
||||
foreach ($result2 as $val2) {
|
||||
$req_data1 = array();
|
||||
$req_data1['content_type'] = $content_type;
|
||||
$req_data1['theme_type'] = $val2['theme_type'];
|
||||
$req_data1['rank'] = $val2['rank'];
|
||||
$rank_count = $ci->m_theme->theme_rank_count($req_data1);
|
||||
if($rank_count > 0) {
|
||||
$ci->m_theme->theme_rank_is_del_update($req_data1);
|
||||
}
|
||||
}
|
||||
$ci->m_theme->theme_is_display_update_batch($result2);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 기타섹션 노출로 변경
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_etc_section_change_is_display($req_data){
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$ci->load->model('admin/etc_section/m_etc_section');
|
||||
$result3 = $ci->m_etc_section->etc_section_content_idx_list($req_data);
|
||||
if(count($result3) > 0) {
|
||||
foreach ($result3 as $val3) {
|
||||
$req_data1 = array();
|
||||
$req_data1['etc_section_type'] = $val3['etc_section_type'];
|
||||
$req_data1['rank'] = $val3['rank'];
|
||||
$rank_count = $ci->m_etc_section->etc_section_rank_count($req_data1);
|
||||
if($rank_count > 0) {
|
||||
$ci->m_etc_section->etc_section_rank_is_del_update($req_data1);
|
||||
}
|
||||
}
|
||||
$ci->m_etc_section->etc_section_is_display_update_batch($result3);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
477
application/libraries/Comm_back_190326.php
Executable file
477
application/libraries/Comm_back_190326.php
Executable file
@@ -0,0 +1,477 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Comm
|
||||
{
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 로그인
|
||||
# CREATE : 2018-04-24
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_login_proc($req_data){
|
||||
$ci=& get_instance();
|
||||
$ci->load->helper('cookie');
|
||||
$ci->load->library('session');
|
||||
|
||||
# 회원정보
|
||||
$idx = $req_data['idx'];
|
||||
$member_name = $req_data['member_name'];
|
||||
$member_group_idx = $req_data['member_group_idx'];
|
||||
$member_nickname = $req_data['member_nickname'];
|
||||
$member_intro = $req_data['member_intro'];
|
||||
$member_img = $req_data['member_img'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$member_email = $req_data['member_email'];
|
||||
if($member_nickname == '') $member_nickname = $member_name;
|
||||
|
||||
$save_login = 'N';
|
||||
if(isset($req_data['save_login'])==true) {
|
||||
$save_login = $req_data['save_login'];
|
||||
}
|
||||
|
||||
# 마지막 로그인 정보 업데이트
|
||||
$ci->m_member->member_visit_count_last_login_update($idx);
|
||||
|
||||
# 로그인 로그 남기기
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
# model
|
||||
$ci->load->model('web/m_member_login_log');
|
||||
$ci->m_member_login_log->member_login_log_insert($req_data);
|
||||
|
||||
# model
|
||||
$ci->load->model('web/m_member_group');
|
||||
$arr_member_group = $ci->m_member_group->member_group_select($member_group_idx);
|
||||
$member_group_name = '';
|
||||
if(isset($arr_member_group['member_group_name'])==true){
|
||||
$member_group_name = $arr_member_group['member_group_name'];
|
||||
}
|
||||
|
||||
$session_id = $ci->session->session_id;
|
||||
|
||||
|
||||
# 세션저장
|
||||
$ci->session->set_userdata('C_Member_Name', $member_name);
|
||||
$ci->session->set_userdata('C_Member_Id', $member_id);
|
||||
$ci->session->set_userdata('C_Member_Nicname', $member_nickname);
|
||||
$ci->session->set_userdata('C_Member_Group', $member_group_idx);
|
||||
$ci->session->set_userdata('C_Member_Group_Name', $member_group_name);
|
||||
$ci->session->set_userdata('C_Member_Intro', $member_intro);
|
||||
$ci->session->set_userdata('C_Member_Profile', $member_img);
|
||||
$ci->session->set_userdata('C_Member_Email', $member_email);
|
||||
|
||||
set_cookie('crossmap_save_login', $save_login, 86400 * 90);
|
||||
if($save_login=='Y') {
|
||||
set_cookie('crossmap_save_id', $session_id, 86400 * 90);
|
||||
} else {
|
||||
set_cookie('crossmap_save_id', '', 86400 * 90);
|
||||
}
|
||||
|
||||
set_cookie('crossmap_comment_sns_id', $member_id, 0);
|
||||
set_cookie('crossmap_comment_sns_name', $member_nickname, 0);
|
||||
set_cookie('crossmap_comment_sns_type', 'cm', 0);
|
||||
|
||||
|
||||
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
|
||||
|
||||
# model
|
||||
$msg = '';
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ci->load->model('web/m_member_login');
|
||||
$member_login_count = $ci->m_member_login->member_login_member_id_count($req_data);
|
||||
if($member_login_count > 0){
|
||||
$msg = '현재 동시접속중인 사용자가 있습니다.';
|
||||
$ci->m_member_login->member_login_delete($req_data);
|
||||
|
||||
}
|
||||
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
$req_data['expire_date'] = $expire_date;
|
||||
$ci->m_member_login->member_login_insert($req_data);
|
||||
|
||||
|
||||
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 로그아웃
|
||||
# CREATE : 2018-04-25
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_logout_proc(){
|
||||
$ci=& get_instance();
|
||||
$ci->load->helper('cookie');
|
||||
$ci->load->library('session');
|
||||
|
||||
|
||||
$member_id = $ci->session->userdata('C_Member_Id');
|
||||
|
||||
|
||||
# 세션정보 unset
|
||||
$ci->session->unset_userdata('C_Member_Name');
|
||||
$ci->session->unset_userdata('C_Member_Id');
|
||||
$ci->session->unset_userdata('C_Member_Nicname');
|
||||
$ci->session->unset_userdata('C_Member_Group');
|
||||
$ci->session->unset_userdata('C_Member_Group_Name');
|
||||
$ci->session->unset_userdata('C_Member_Intro');
|
||||
$ci->session->unset_userdata('C_Member_Profile');
|
||||
$ci->session->unset_userdata('C_Member_Email');
|
||||
|
||||
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);
|
||||
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $member_id;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$ci->load->model('web/m_member_login');
|
||||
$ci->m_member_login->member_login_delete($req_data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : hit_count update
|
||||
# CREATE : 2018-04-26
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_hit_count_update($req_data){
|
||||
$ci=& get_instance();
|
||||
|
||||
$reg_date = date("Y-m-d H:i:s", strtotime("-1 hours"));
|
||||
|
||||
if($req_data['member_id']=='') $req_data['member_id'] = '';
|
||||
|
||||
$ci->load->model('web/m_hit_log');
|
||||
$count = 0;
|
||||
if($req_data['member_id'] !='') {
|
||||
$req_data1 = array();
|
||||
$req_data1['reg_date'] = $reg_date;
|
||||
$req_data1['content_type'] = $req_data['content_type'];
|
||||
$req_data1['content_idx'] = $req_data['content_idx'];
|
||||
$req_data1['member_id'] = $req_data['member_id'];
|
||||
|
||||
$count = $ci->m_hit_log->hit_log_where_member_id_content_idx_count($req_data1);
|
||||
}
|
||||
|
||||
if($count==0) {
|
||||
$ci->m_hit_log->hit_log_insert($req_data);
|
||||
|
||||
$content_type = $req_data['content_type'];
|
||||
$idx = $req_data['content_idx'];
|
||||
|
||||
# 각 글 hit+1
|
||||
if($content_type == '3') {
|
||||
$ci->load->model('web/m_life');
|
||||
$ci->m_life->life_hit_count_update($idx);
|
||||
|
||||
} else if($content_type == '2') {
|
||||
$ci->load->model('web/m_column');
|
||||
$ci->m_column->column_hit_count_update($idx);
|
||||
|
||||
} else if($content_type == '1') {
|
||||
$ci->load->model('web/m_news');
|
||||
$ci->m_news->news_hit_count_update($idx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 댓글 로그인
|
||||
# CREATE : 2018-04-27
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_comment_login_proc($req_data){
|
||||
$ci=& get_instance();
|
||||
$ci->load->helper('cookie');
|
||||
|
||||
# 회원정보
|
||||
$member_name = $req_data['member_name'];
|
||||
$member_id = $req_data['member_id'];
|
||||
$sns_type_name = $req_data['sns_type_name'];
|
||||
|
||||
set_cookie('crossmap_comment_sns_id', $member_id, 0);
|
||||
set_cookie('crossmap_comment_sns_name', $member_name, 0);
|
||||
set_cookie('crossmap_comment_sns_type', $sns_type_name, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 뉴스 footer
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_news_footer() {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$theme_types = array('3');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
$arr_recomm_news = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 3) $arr_recomm_news[$val['rank']] = $val;
|
||||
}
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$theme_types = array('6');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
$arr_m_recomm_news = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 6) $arr_m_recomm_news[$val['rank']] = $val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
# 실시간급상승
|
||||
$req_data = array();
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 20;
|
||||
|
||||
$ci->load->model('web/m_realtime_keyword');
|
||||
$arr_realtime_keyword = $ci->m_realtime_keyword->realtime_keyword_list($req_data);
|
||||
|
||||
|
||||
$news_footer = array();
|
||||
$news_footer['arr_recomm_news'] = $arr_recomm_news;
|
||||
$news_footer['arr_m_recomm_news'] = $arr_m_recomm_news;
|
||||
$news_footer['arr_realtime_keyword'] = $arr_realtime_keyword;
|
||||
|
||||
|
||||
return $news_footer;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 뉴스 right
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_news_right() {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
# 테마
|
||||
# 2: 주요뉴스 / 4: 오늘의포토 / 7: 헤드라인칼럼 / 8: 오늘의칼럼 / 9:추천연재 / 15: 추천라이프
|
||||
$theme_types = array('2','4','7','8','9','15');
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
|
||||
$arr_main_news = array();
|
||||
$arr_today_photo = array();
|
||||
$arr_headline_column = array();
|
||||
$arr_today_column = array();
|
||||
$arr_recomm_column = array();
|
||||
$arr_recomm_life = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 2) $arr_main_news[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 4) $arr_today_photo[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 7) $arr_headline_column[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'column_name'=> $val['column_name'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'partner_idx' => $val['partner_idx'], 'content' => $val['content']);
|
||||
if($val['theme_type'] == 8) $arr_today_column[$val['rank']] = array('title' => $val['title'], 'column_name'=> $val['column_name'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 9) $arr_recomm_column[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'column_name'=> $val['column_name'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx'], 'partner_idx' => $val['partner_idx']);
|
||||
if($val['theme_type'] == 15) $arr_recomm_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
}
|
||||
|
||||
# 기타섹션 - 인기영상 1 / 인기포토 2
|
||||
$ci->load->model('web/m_etc_section');
|
||||
$req_data = array();
|
||||
$req_data['etc_section_types'] = array('1', '2');
|
||||
$arr_etc_section = $ci->m_etc_section->etc_section_where_in_etc_section_type_list($req_data);
|
||||
|
||||
$arr_p_photo = array();
|
||||
$arr_p_video = array();
|
||||
foreach ($arr_etc_section as $val) {
|
||||
if($val['etc_section_type'] == 2) $arr_p_photo[$val['rank']] = array('content_type'=>$val['content_type'], 'head_title'=>$val['head_title'], 'title' => $val['title'], 'main_video' => $val['main_video'], 'video_url' => $val['video_url'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['etc_section_type'] == 1) $arr_p_video[$val['rank']] = array('content_type'=>$val['content_type'], 'head_title'=>$val['head_title'], 'title' => $val['title'], 'main_video' => $val['main_video'], 'video_url' => $val['video_url'], 'main_img' => $val['main_img'], 'content_idx' => $val['content_idx']);
|
||||
}
|
||||
|
||||
# 라이브인기글 --> 라이프 랭킹 - 많이본 TOP5
|
||||
$req_data = array();
|
||||
$req_data['ranking_type'] = '1';
|
||||
$req_data['content_type'] = '3';
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 50;
|
||||
$ci->load->model('web/m_ranking');
|
||||
$arr_life_ranking = $ci->m_ranking->ranking_join_life_list($req_data);
|
||||
|
||||
|
||||
# 실시간급상승
|
||||
$req_data = array();
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 20;
|
||||
|
||||
$ci->load->model('web/m_realtime_keyword');
|
||||
$arr_realtime_keyword = $ci->m_realtime_keyword->realtime_keyword_list($req_data);
|
||||
|
||||
|
||||
$arr_news_right = array();
|
||||
$arr_news_right['arr_main_news'] = $arr_main_news;
|
||||
$arr_news_right['arr_today_photo'] = $arr_today_photo;
|
||||
$arr_news_right['arr_recomm_column'] = $arr_recomm_column;
|
||||
$arr_news_right['arr_recomm_life'] = $arr_recomm_life;
|
||||
$arr_news_right['arr_life_ranking'] = $arr_life_ranking;
|
||||
$arr_news_right['arr_p_photo'] = $arr_p_photo;
|
||||
$arr_news_right['arr_p_video'] = $arr_p_video;
|
||||
$arr_news_right['arr_realtime_keyword'] = $arr_realtime_keyword;
|
||||
$arr_news_right['arr_headline_column'] = $arr_headline_column;
|
||||
$arr_news_right['arr_today_column'] = $arr_today_column;
|
||||
|
||||
return $arr_news_right;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 댓글
|
||||
# CREATE : 2018-04-29
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_comment($req_data) {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$content_type = $req_data['content_type'];
|
||||
$content_idx = $req_data['content_idx'];
|
||||
$offset = $req_data['offset'];
|
||||
$limit = $req_data['limit'];
|
||||
$sort_column = $req_data['sort_column'];
|
||||
$sort_type = $req_data['sort_type'];
|
||||
$write_id = $req_data['write_id'];
|
||||
|
||||
# 댓글
|
||||
$ci->load->model('web/m_comment');
|
||||
|
||||
# 총댓글수
|
||||
$req_data = array();
|
||||
$req_data['content_type'] = $content_type;
|
||||
$req_data['content_idx'] = $content_idx;
|
||||
$comment_total_count = $ci->m_comment->comment_parent_where_content_idx_count($req_data);
|
||||
|
||||
# 본인삭제 수
|
||||
$req_data['write_id'] = $write_id;
|
||||
$comment_my_delete_count = $ci->m_comment->comment_my_delete_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 = $ci->m_comment->comment_parent_list($req_data);
|
||||
|
||||
|
||||
$return_data = array();
|
||||
$return_data['comment_total_count'] = $comment_total_count;
|
||||
$return_data['comment_my_delete_count'] = $comment_my_delete_count;
|
||||
$return_data['arr_comment'] = $arr_comment;
|
||||
|
||||
return $return_data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 라이프 right
|
||||
# CREATE : 2018-04-28
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_life_right_comm($theme_types) {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
# 테마
|
||||
# 13: 라이프 스타일, 14: 지금뜨는 라이프
|
||||
$ci->load->model('web/m_theme');
|
||||
$req_data = array();
|
||||
$req_data['theme_types'] = $theme_types;
|
||||
$arr_theme = $ci->m_theme->theme_join_vw_content_where_in_theme_type_list($req_data);
|
||||
|
||||
|
||||
$arr_life_style = array();
|
||||
$arr_boomup_life = array();
|
||||
foreach ($arr_theme as $val) {
|
||||
if($val['theme_type'] == 13) $arr_life_style[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
if($val['theme_type'] == 14) $arr_boomup_life[$val['rank']] = array('rank'=>$val['rank'], 'title' => $val['title'], 'sub_content' => $val['sub_content'], 'theme_img' => $val['theme_img'], 'content_idx' => $val['content_idx']);
|
||||
}
|
||||
|
||||
|
||||
# 라이프 공감글 --> 라이프 랭킹 - 공감많은 TOP3
|
||||
$req_data = array();
|
||||
$req_data['ranking_type'] = '3';
|
||||
$req_data['content_type'] = '3';
|
||||
$req_data['offset'] = 0;
|
||||
$req_data['limit'] = 3;
|
||||
$ci->load->model('web/m_ranking');
|
||||
$arr_life_ranking = $ci->m_ranking->ranking_list($req_data);
|
||||
|
||||
|
||||
$arr_news_comm = array();
|
||||
$arr_news_comm['arr_life_style'] = $arr_life_style;
|
||||
$arr_news_comm['arr_boomup_life'] = $arr_boomup_life;
|
||||
$arr_news_comm['arr_life_ranking'] = $arr_life_ranking;
|
||||
|
||||
|
||||
return $arr_news_comm;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 금칙어 체크
|
||||
# CREATE : 2018-05-03
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_forbidden_word($word) {
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
$ci->load->model('web/m_forbidden_word');
|
||||
$count = $ci->m_forbidden_word->forbidden_word_where_word_count($word);
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
32
application/libraries/Comm_check.php
Executable file
32
application/libraries/Comm_check.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Comm_check
|
||||
{
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : 회원그룹별 체크
|
||||
# CREATE : 2018-03-22
|
||||
#---------------------------------------------------------------------------
|
||||
public function fn_member_group_check($req_data){
|
||||
|
||||
$ci=& get_instance();
|
||||
|
||||
# model
|
||||
$ci->load->model('web/m_member_group_menu_auth');
|
||||
$count = $ci->m_member_group_menu_auth->member_group_menu_auth_count($req_data);
|
||||
|
||||
return $count;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
65
application/libraries/CommentService.php
Executable file
65
application/libraries/CommentService.php
Executable file
@@ -0,0 +1,65 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class CommentService
|
||||
{
|
||||
private $db;
|
||||
private $CI;
|
||||
private $commentModel;
|
||||
private $likeLogModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->CI = &get_instance();
|
||||
$this->CI->load->library('session');
|
||||
$this->CI->load->model('comment_model');
|
||||
$this->CI->load->model('category_model');
|
||||
$this->CI->load->model('editor_model');
|
||||
$this->lifeModel = &$this->CI->life_model;
|
||||
$this->categoryModel = &$this->CI->category_model;
|
||||
$this->editorModel = &$this->CI->editor_model;
|
||||
$this->db = &$this->CI->db;
|
||||
}
|
||||
|
||||
public function getPostById($postId)
|
||||
{
|
||||
return $this->lifeModel->findById($postId)
|
||||
// ->where('l.is_display', 1)
|
||||
->where('l.is_del', 'N')
|
||||
->get()->row();
|
||||
}
|
||||
|
||||
public function getPostsByEditorId($editorId, $limit = 16, $orderBy = 'update_date', $sort = 'desc', $ignores = array())
|
||||
{
|
||||
$this->lifeModel->findByEditorId($editorId)->order_by('l.' . $orderBy, $sort)
|
||||
// ->where('l.is_display', 1)
|
||||
->where('l.is_del', 'N')
|
||||
->limit($limit);
|
||||
if (is_array($ignores) && count($ignores)) {
|
||||
$this->db->where_not_in('l.idx', $ignores);
|
||||
}
|
||||
$posts = $this->db->get()->result();
|
||||
return $this->urify($posts);
|
||||
}
|
||||
|
||||
public function getPostsByCategoryId($categoryId, $limit = 16, $orderBy = 'update_date', $sort = 'desc', $ignores = array())
|
||||
{
|
||||
$this->lifeModel->findByCategoryId($categoryId)
|
||||
// ->where('l.is_display', 1)
|
||||
->where('l.is_del', 'N')
|
||||
->order_by('l.' . $orderBy, $sort)->limit($limit);
|
||||
if (is_array($ignores) && count($ignores)) {
|
||||
$this->db->where_not_in('l.idx', $ignores);
|
||||
}
|
||||
$posts = $this->db->get()->result();
|
||||
return $this->urify($posts);
|
||||
}
|
||||
|
||||
private function urify(&$posts)
|
||||
{
|
||||
foreach ($posts as $k => $p) {
|
||||
$posts[$k]->titleUrl = cleanUrl($p->title);
|
||||
$posts[$k]->editorNameUrl = cleanUrl($p->editorName);
|
||||
}
|
||||
return $posts;
|
||||
}
|
||||
}
|
||||
9
application/libraries/Excel.php
Executable file
9
application/libraries/Excel.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH."/third_party/PHPExcel.php";
|
||||
|
||||
class Excel extends PHPExcel {
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
224
application/libraries/ImageUpload.php
Executable file
224
application/libraries/ImageUpload.php
Executable file
@@ -0,0 +1,224 @@
|
||||
<?php
|
||||
|
||||
class ImageUpload extends CI_Upload {
|
||||
|
||||
// declare disallowed types variable
|
||||
var $disallowed_types = '';
|
||||
|
||||
// add in the 'disallowed_types' default during initialization
|
||||
function initialize($config = array()) {
|
||||
$defaults = array(
|
||||
'max_size' => 0,
|
||||
'max_width' => 0,
|
||||
'max_height' => 0,
|
||||
'max_filename' => 0,
|
||||
'allowed_types' => "",
|
||||
'disallowed_types' => "",
|
||||
'file_temp' => "",
|
||||
'file_name' => "",
|
||||
'orig_name' => "",
|
||||
'file_type' => "",
|
||||
'file_size' => "",
|
||||
'file_ext' => "",
|
||||
'upload_path' => "",
|
||||
'overwrite' => FALSE,
|
||||
'encrypt_name' => FALSE,
|
||||
'is_image' => FALSE,
|
||||
'image_width' => '',
|
||||
'image_height' => '',
|
||||
'image_type' => '',
|
||||
'image_size_str' => '',
|
||||
'error_msg' => array(),
|
||||
'mimes' => array(),
|
||||
'remove_spaces' => TRUE,
|
||||
'xss_clean' => FALSE,
|
||||
'temp_prefix' => "temp_file_"
|
||||
);
|
||||
|
||||
foreach ($defaults as $key => $val) {
|
||||
if (isset($config[$key])) {
|
||||
$method = 'set_'.$key;
|
||||
|
||||
if (method_exists($this, $method)) {
|
||||
$this->$method($config[$key]);
|
||||
}
|
||||
else {
|
||||
$this->$key = $config[$key];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->$key = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set disallowed filetypes
|
||||
function set_disallowed_types($types) {
|
||||
$this->disallowed_types = explode('|', $types);
|
||||
}
|
||||
|
||||
// adapted to not require allowed_types and to check for disallowed types if it exists
|
||||
function is_allowed_filetype() {
|
||||
// if allowed file type list is not defined
|
||||
if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types)) {
|
||||
// if disallowed file type list is not defined
|
||||
if (count($this->disallowed_types) == 0 OR ! is_array($this->disallowed_types))
|
||||
return TRUE;
|
||||
|
||||
// check for disallowed file types and return
|
||||
// negated because is_disallowed_filetype returns opposite result as this function
|
||||
return ! $this->is_disallowed_filetype();
|
||||
}
|
||||
|
||||
// proceed as usual with allowed file type list check
|
||||
return parent::is_allowed_filetype();
|
||||
}
|
||||
|
||||
// check for disallowed file types
|
||||
function is_disallowed_filetype() {
|
||||
// no file types provided
|
||||
if (count($this->disallowed_types) == 0 OR ! is_array($this->disallowed_types))
|
||||
return FALSE;
|
||||
|
||||
// search through disallowed for this file type
|
||||
foreach ($this->disallowed_types as $val) {
|
||||
$mime = $this->mimes_types(strtolower($val));
|
||||
|
||||
if (is_array($mime)) {
|
||||
if (in_array($this->file_type, $mime, TRUE)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($mime == $this->file_type) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function do_upload($field = 'userfile', $new_name='') {
|
||||
|
||||
|
||||
echo "aa";
|
||||
exit();
|
||||
if ( ! isset($_FILES[$field])) {
|
||||
$this->set_error('upload_no_file_selected');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! $this->validate_upload_path()) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! is_uploaded_file($_FILES[$field]['tmp_name'])) {
|
||||
$error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error'];
|
||||
|
||||
switch($error) {
|
||||
case 1: // UPLOAD_ERR_INI_SIZE
|
||||
$this->set_error('upload_file_exceeds_limit');
|
||||
break;
|
||||
case 2: // UPLOAD_ERR_FORM_SIZE
|
||||
$this->set_error('upload_file_exceeds_form_limit');
|
||||
break;
|
||||
case 3: // UPLOAD_ERR_PARTIAL
|
||||
$this->set_error('upload_file_partial');
|
||||
break;
|
||||
case 4: // UPLOAD_ERR_NO_FILE
|
||||
$this->set_error('upload_no_file_selected');
|
||||
break;
|
||||
case 6: // UPLOAD_ERR_NO_TMP_DIR
|
||||
$this->set_error('upload_no_temp_directory');
|
||||
break;
|
||||
case 7: // UPLOAD_ERR_CANT_WRITE
|
||||
$this->set_error('upload_unable_to_write_file');
|
||||
break;
|
||||
case 8: // UPLOAD_ERR_EXTENSION
|
||||
$this->set_error('upload_stopped_by_extension');
|
||||
break;
|
||||
default :
|
||||
$this->set_error('upload_no_file_selected');
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->file_temp = $_FILES[$field]['tmp_name'];
|
||||
$this->file_size = $_FILES[$field]['size'];
|
||||
$this->file_type = preg_replace("/^(.+?);.*$/", "\\1", $_FILES[$field]['type']);
|
||||
$this->file_type = strtolower($this->file_type);
|
||||
$this->file_ext = $this->get_extension($_FILES[$field]['name']);
|
||||
|
||||
// check if a name has been specified, if so set it
|
||||
if ($new_name != '') {
|
||||
$this->file_name = $this->_prep_filename($new_name . $this->file_ext);
|
||||
}
|
||||
else {
|
||||
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);
|
||||
}
|
||||
|
||||
if ($this->file_size > 0) {
|
||||
$this->file_size = round($this->file_size/1024, 2);
|
||||
}
|
||||
|
||||
if ( ! $this->is_allowed_filetype()) {
|
||||
$this->set_error('upload_invalid_filetype');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! $this->is_allowed_filesize()) {
|
||||
$this->set_error('upload_invalid_filesize');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( ! $this->is_allowed_dimensions()) {
|
||||
$this->set_error('upload_invalid_dimensions');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->file_name = $this->clean_file_name($this->file_name);
|
||||
|
||||
if ($this->max_filename > 0) {
|
||||
$this->file_name = $this->limit_filename_length($this->file_name, $this->max_filename);
|
||||
}
|
||||
|
||||
if ($this->remove_spaces == TRUE) {
|
||||
$this->file_name = preg_replace("/\s+/", "_", $this->file_name);
|
||||
}
|
||||
|
||||
$this->orig_name = $this->file_name;
|
||||
|
||||
if ($this->overwrite == FALSE) {
|
||||
$this->file_name = $this->set_filename($this->upload_path, $this->file_name);
|
||||
|
||||
if ($this->file_name === FALSE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! @copy($this->file_temp, $this->upload_path.$this->file_name)) {
|
||||
if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name))
|
||||
{
|
||||
$this->set_error('upload_destination_error');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->xss_clean == TRUE) {
|
||||
$this->do_xss_clean();
|
||||
}
|
||||
|
||||
$this->set_image_properties($this->upload_path.$this->file_name);
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
90
application/libraries/Maptoon_lib.php
Executable file
90
application/libraries/Maptoon_lib.php
Executable file
@@ -0,0 +1,90 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Maptoon_lib {
|
||||
|
||||
var $file_cache_path = '';
|
||||
var $CI = null;
|
||||
private $db;
|
||||
|
||||
public function __construct($params) {
|
||||
if(isset($params['file_cache_path'])==TRUE && $params['file_cache_path']!='') {
|
||||
$this->file_cache_path = $params['file_cache_path'];
|
||||
}
|
||||
$this->CI = &get_instance();
|
||||
$this->db = &$this->CI->db;
|
||||
$this->load = &$this->CI->load;
|
||||
}
|
||||
|
||||
/*
|
||||
write category cache file
|
||||
@param (numeric) maptoon category table idx
|
||||
@param (string) episode data by category idx
|
||||
@return (boolean)
|
||||
*/
|
||||
public function write_category_cache($cid,$json_data) {
|
||||
if(is_numeric($cid)==FALSE || $cid<=0) {
|
||||
return FALSE;
|
||||
}
|
||||
$this->CI->load->helper('file');
|
||||
$fname = $this->get_category_cache_name($cid);
|
||||
if($fname!='') {
|
||||
return write_file($fname, $json_data, 'w');
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_category_cache($cid) {
|
||||
return $this->getEpisodeCategory($cid);
|
||||
if(is_numeric($cid)==FALSE || $cid<=0) {
|
||||
return FALSE;
|
||||
}
|
||||
$this->CI->load->helper('file');
|
||||
$fname = $this->get_category_cache_name($cid);
|
||||
if($fname!='') {
|
||||
return read_file($fname);
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
get category cache file name
|
||||
@param (numeric) maptoon category table idx
|
||||
@return (string | null)
|
||||
*/
|
||||
public function get_category_cache_name($cid) {
|
||||
if(is_numeric($cid)==TRUE && $cid>0) {
|
||||
$fname = $this->file_cache_path.'category'.$cid;
|
||||
return $fname;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function getEpisodeCategory($categoryId) {
|
||||
$query = "SELECT idx,mt_episodes_idx FROM mt_categories where idx=$categoryId";
|
||||
$result = $this->db->query($query);
|
||||
foreach ($result->result_array() as $row){
|
||||
$episodes_idx = explode(",",$row['mt_episodes_idx']);
|
||||
$str = $row['mt_episodes_idx'];
|
||||
$idx = $row['idx'];
|
||||
|
||||
$len = count($episodes_idx);
|
||||
|
||||
if(is_array($episodes_idx)==TRUE && is_numeric($idx)==TRUE
|
||||
&& $idx>0 && $len>0) {
|
||||
$this->load->model('maptoon/m_maptoon');
|
||||
$ret = $this->CI->m_maptoon->update_episodes_by_category($idx,$str);
|
||||
|
||||
$this->CI->config->load('filecache',TRUE);
|
||||
$file_cache_path = $this->CI->config->item('file_cache_path','filecache');
|
||||
$params = array('file_cache_path'=>$file_cache_path);
|
||||
$this->load->library('maptoon_lib',$params);
|
||||
|
||||
// get episode data to write cache
|
||||
return $this->CI->m_maptoon->get_widget_info_by_episode_idx($episodes_idx,'json');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
49
application/libraries/Mt_pagination.php
Executable file
49
application/libraries/Mt_pagination.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
class Mt_pagination
|
||||
{
|
||||
#---------------------------------------------------------------------------
|
||||
# PURPOSE : mt_pagination
|
||||
# CREATE : 2019-03-20
|
||||
#---------------------------------------------------------------------------
|
||||
public function create_pagenation($req_data){
|
||||
# request
|
||||
$total_count= $req_data['total_count'];
|
||||
$limit = $req_data['limit'];
|
||||
$base_url = $req_data['base_url'];
|
||||
|
||||
$ci=& get_instance();
|
||||
$ci->load->library('pagination');
|
||||
|
||||
$config['base_url'] = $base_url ;
|
||||
$config['total_rows'] = $total_count;
|
||||
$config['per_page'] = $limit;
|
||||
$config['num_links'] = 4;
|
||||
|
||||
$config['enable_query_strings'] = TRUE;
|
||||
$config['page_query_string'] = TRUE;
|
||||
$config['use_page_numbers'] = TRUE;
|
||||
$config['reuse_query_string'] = TRUE;
|
||||
$config['query_string_segment'] = 'page';
|
||||
|
||||
$config['full_tag_open'] = '<div class="pagination">';
|
||||
$config['full_tag_close'] = '</div>';
|
||||
|
||||
$config['first_link'] = false;
|
||||
$config['last_link'] = false;
|
||||
$config['prev_link'] = '이전<i class="prev prev-angle"></i>';
|
||||
$config['next_link'] = '다음<i class="next next-angle"></i>';
|
||||
$config['cur_tag_open'] = '<span class="current">';
|
||||
$config['cur_tag_close'] = ' </span>';
|
||||
|
||||
$ci->pagination->initialize($config);
|
||||
$pagination = $ci->pagination->create_links();
|
||||
|
||||
|
||||
return $pagination;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
245
application/libraries/Post.php
Executable file
245
application/libraries/Post.php
Executable file
@@ -0,0 +1,245 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Post
|
||||
{
|
||||
private $db;
|
||||
private $CI;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->CI = &get_instance();
|
||||
$this->CI->load->library('session');
|
||||
$this->db = &$this->CI->db;
|
||||
}
|
||||
|
||||
public function getPost($postId)
|
||||
{
|
||||
$query = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`l`.`title`,
|
||||
`l`.`head_title`,
|
||||
`l`.`sub_title`,
|
||||
`l`.`content`,
|
||||
`l`.`category_idx` `categoryId`,
|
||||
`l`.`idx`,
|
||||
`l`.`main_img` `mainImg`,
|
||||
`l`.`hit_count` `views`,
|
||||
`l`.`like_count` `likes`,
|
||||
`l`.`comment_count` `comments`,
|
||||
`l`.*
|
||||
FROM
|
||||
`life` `l`
|
||||
LEFT JOIN
|
||||
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
|
||||
WHERE
|
||||
`l`.`idx` IN ($postId)
|
||||
AND `l`.`is_display` = 'Y'
|
||||
AND `l`.`is_del` = 'N'");
|
||||
|
||||
return $this->urify($query->result())[0];
|
||||
}
|
||||
|
||||
public function getPostJoin1($postId)
|
||||
{
|
||||
$query = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`l`.`title`,
|
||||
`l`.`head_title`,
|
||||
`l`.`sub_title`,
|
||||
`l`.`content`,
|
||||
`l`.`category_idx` `categoryId`,
|
||||
`l`.`idx`,
|
||||
`l`.`main_img` `mainImg`,
|
||||
`l`.`hit_count` `views`,
|
||||
`l`.`like_count` `likes`,
|
||||
`l`.`comment_count` `comments`,
|
||||
`l`.*
|
||||
FROM
|
||||
`life` `l`
|
||||
LEFT JOIN
|
||||
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
|
||||
left JOIN
|
||||
cm_config cf on l.idx=cf.PostId
|
||||
WHERE
|
||||
`l`.`idx` IN ($postId)
|
||||
AND `l`.`is_display` = 'Y'
|
||||
AND `l`.`is_del` = 'N' order by cf.OrderNum ");
|
||||
|
||||
return $this->urify($query->result());
|
||||
}
|
||||
|
||||
public function getEditorPosts($editorId, $limit = 16, $orderBy = 'update_date', $sort = 'desc', $ignores = array())
|
||||
{
|
||||
if (is_array($editorId)) {
|
||||
$editorId = implode(",", $editorId);
|
||||
}
|
||||
$ignoreId = '';
|
||||
if (is_array($ignores) && count($ignores)) {
|
||||
$ignoreId = " and l.idx not in (" . implode(",", $ignores) . ")";
|
||||
}
|
||||
|
||||
$query = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`l`.`title`,
|
||||
`l`.`head_title`,
|
||||
`l`.`sub_title`,
|
||||
`l`.`content`,
|
||||
`l`.`category_idx` `categoryId`,
|
||||
`l`.`idx`,
|
||||
`l`.`main_img` `mainImg`,
|
||||
`l`.`hit_count` `views`,
|
||||
`l`.`like_count` `likes`,
|
||||
`l`.`comment_count` `comments`,
|
||||
`l`.*
|
||||
FROM
|
||||
`life` `l`
|
||||
LEFT JOIN
|
||||
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
|
||||
WHERE
|
||||
`l`.`partner_idx` IN ($editorId)
|
||||
AND `l`.`is_display` = 'Y'
|
||||
AND `l`.`is_del` = 'N'
|
||||
$ignoreId
|
||||
ORDER BY `l`.`$orderBy` $sort
|
||||
LIMIT $limit");
|
||||
$posts = $query->result();
|
||||
return $this->urify($posts);
|
||||
}
|
||||
|
||||
public function getPostsByCategoryId($categoryId, $limit = 16, $orderBy = 'reg_date', $sort = 'desc', $ignores = array())
|
||||
{
|
||||
if (is_array($categoryId)) {
|
||||
$categoryId = implode(",", $categoryId);
|
||||
}
|
||||
$ignoreId = '';
|
||||
if (is_array($ignores) && count($ignores)) {
|
||||
$ignoreId = " and l.idx not in (" . implode(",", $ignores) . ")";
|
||||
}
|
||||
$query = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`l`.`title`,
|
||||
`l`.`head_title`,
|
||||
`l`.`sub_title`,
|
||||
`l`.`content`,
|
||||
`l`.`category_idx` `categoryId`,
|
||||
`l`.`idx`,
|
||||
`l`.`main_img` `mainImg`,
|
||||
`l`.`hit_count` `views`,
|
||||
`l`.`like_count` `likes`,
|
||||
`l`.`comment_count` `comments`,
|
||||
`l`.`update_date`,
|
||||
`l`.`reg_date`
|
||||
FROM
|
||||
`life` `l`
|
||||
LEFT JOIN
|
||||
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
|
||||
WHERE
|
||||
`l`.`category_idx` IN ($categoryId)
|
||||
AND `l`.`is_display` = 'Y'
|
||||
AND `l`.`is_del` = 'N' $ignoreId
|
||||
ORDER BY `l`.`$orderBy` DESC
|
||||
LIMIT $limit");
|
||||
|
||||
$posts = $query->result();
|
||||
return $this->urify($posts);
|
||||
}
|
||||
|
||||
public function getPostsEditorRecent($categoryId, $limit = 16, $orderBy = 'reg_date', $sort = 'desc', $ignores = array())
|
||||
{
|
||||
if (is_array($categoryId)) {
|
||||
$categoryId = implode(",", $categoryId);
|
||||
}
|
||||
$ignoreId = '';
|
||||
if (is_array($ignores) && count($ignores)) {
|
||||
$ignoreId = " and l.idx not in (" . implode(",", $ignores) . ")";
|
||||
}
|
||||
$query = $this->db->query("SELECT
|
||||
`p`.`idx` `editorId`,
|
||||
`p`.`partner_img` `editorImg`,
|
||||
`p`.`main_img` `editorMainImg`,
|
||||
`p`.`partner_name` `editorName`,
|
||||
`p`.`partner_intro` `editorIntro`,
|
||||
`l`.`title`,
|
||||
`l`.`head_title`,
|
||||
`l`.`sub_title`,
|
||||
`l`.`content`,
|
||||
`l`.`category_idx` `categoryId`,
|
||||
`l`.`idx`,
|
||||
`l`.`main_img` `mainImg`,
|
||||
`l`.`hit_count` `views`,
|
||||
`l`.`like_count` `likes`,
|
||||
`l`.`comment_count` `comments`,
|
||||
`l`.`update_date`,
|
||||
`l`.`reg_date`
|
||||
FROM
|
||||
`life` `l`
|
||||
LEFT JOIN
|
||||
`partner` `p` ON `l`.`partner_idx` = `p`.`idx`
|
||||
WHERE
|
||||
`l`.`category_idx` IN ($categoryId)
|
||||
AND `l`.`is_display` = 'Y'
|
||||
AND `l`.`is_del` = 'N'
|
||||
$ignoreId group by `l`.`partner_idx`
|
||||
ORDER BY `l`.`$orderBy` DESC
|
||||
LIMIT $limit");
|
||||
|
||||
$posts = $query->result();
|
||||
return $this->urify($posts);
|
||||
}
|
||||
|
||||
public function urify($posts)
|
||||
{
|
||||
foreach ($posts as $k => $p) {
|
||||
$posts[$k]->title = convertEmoji($posts[$k]->title, 'DECODE');
|
||||
$posts[$k]->titleUrl = cleanUrl($p->title);
|
||||
$posts[$k]->titleUrl = $posts[$k]->titleUrl ? $posts[$k]->titleUrl : cleanUrl($p->editorName);
|
||||
$posts[$k]->editorNameUrl = cleanUrl($p->editorName);
|
||||
}
|
||||
return $posts;
|
||||
}
|
||||
|
||||
public function getTop10($categoryId)
|
||||
{
|
||||
$filePrefix = 'cmtv_top10_';
|
||||
$filename = $filePrefix . date('dH-', time() - 3600) . (is_array($categoryId) ? 'all' : $categoryId) . '.json';
|
||||
$cacheFilePath = $this->CI->config->item('log_path') . $filename;
|
||||
if (file_exists($cacheFilePath)) {
|
||||
return json_decode(file_get_contents($cacheFilePath));
|
||||
} else {
|
||||
$mask = $this->CI->config->item('log_path') . $filePrefix . '*' . (is_array($categoryId) ? 'all' : $categoryId) . '.json';
|
||||
array_map('unlink', glob($mask));
|
||||
$cmtvTop10 = $this->getPostsByCategoryId($categoryId, 10, 'hit_count', 'desc');
|
||||
file_put_contents($cacheFilePath, json_encode($cmtvTop10));
|
||||
return $cmtvTop10;
|
||||
}
|
||||
}
|
||||
|
||||
public function upload($f)
|
||||
{
|
||||
$config['upload_path'] = FCPATH. 'uploads/';
|
||||
$config['allowed_types'] = 'gif|jpg|png';
|
||||
$this->CI->load->library('upload', $config);
|
||||
if (!$this->CI->upload->do_upload($f)) {
|
||||
return false;
|
||||
} else {
|
||||
return $this->CI->upload->data();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
application/libraries/Remotesearch.php
Executable file
16
application/libraries/Remotesearch.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Remotesearch
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function wikipedia($keyword)
|
||||
{
|
||||
$result = file_get_contents('https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=' . urlencode($keyword) . '&format=json&uselang=ko');
|
||||
return json_decode($result)->query->search;
|
||||
}
|
||||
}
|
||||
53
application/libraries/Util.php
Executable file
53
application/libraries/Util.php
Executable file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Util {
|
||||
|
||||
/*
|
||||
call javascript alert
|
||||
*/
|
||||
public function js_alert($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."');</script>";
|
||||
}
|
||||
}
|
||||
|
||||
public function js_alert_go($msg,$url) {
|
||||
$msg = trim($msg);
|
||||
$url = trim($url);
|
||||
if($msg!='' && $url!='') {
|
||||
echo "<script>alert('".$msg."'); document.location.href='".$url."';</script>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
call javascript alert and go back to previous page
|
||||
*/
|
||||
public function js_alert_back($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."'); history.back();</script>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
call javavscript alert and reload page
|
||||
*/
|
||||
public function js_alert_reload($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."'); document.location.reload();</script>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
call javascript alert and go back to previous page
|
||||
*/
|
||||
public function js_alert_parent_reload($msg='') {
|
||||
$msg = trim($msg);
|
||||
if($msg!='') {
|
||||
echo "<script>alert('".$msg."'); parent.location.reload();</script>";
|
||||
}
|
||||
}
|
||||
}
|
||||
0
application/libraries/Youtube.php
Executable file
0
application/libraries/Youtube.php
Executable file
289
application/libraries/toDel_Upload.php
Executable file
289
application/libraries/toDel_Upload.php
Executable file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
class CM_Upload extends CI_Upload {
|
||||
|
||||
public function do_upload($field = 'userfile')
|
||||
{
|
||||
// Is $_FILES[$field] set? If not, no reason to continue.
|
||||
if (isset($_FILES[$field]))
|
||||
{
|
||||
$_file = $_FILES[$field];
|
||||
}
|
||||
// Does the field name contain array notation?
|
||||
elseif (($c = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $field, $matches)) > 1)
|
||||
{
|
||||
$_file = $_FILES;
|
||||
for ($i = 0; $i < $c; $i++)
|
||||
{
|
||||
// We can't track numeric iterations, only full field names are accepted
|
||||
if (($field = trim($matches[0][$i], '[]')) === '' OR ! isset($_file[$field]))
|
||||
{
|
||||
$_file = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
$_file = $_file[$field];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! isset($_file))
|
||||
{
|
||||
$this->set_error('upload_no_file_selected', 'debug');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Is the upload path valid?
|
||||
if ( ! $this->validate_upload_path())
|
||||
{
|
||||
// errors will already be set by validate_upload_path() so just return FALSE
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Was the file able to be uploaded? If not, determine the reason why.
|
||||
if ( ! is_uploaded_file($_file['tmp_name']))
|
||||
{
|
||||
$error = isset($_file['error']) ? $_file['error'] : 4;
|
||||
|
||||
switch ($error)
|
||||
{
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
$this->set_error('upload_file_exceeds_limit', 'info');
|
||||
break;
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
$this->set_error('upload_file_exceeds_form_limit', 'info');
|
||||
break;
|
||||
case UPLOAD_ERR_PARTIAL:
|
||||
$this->set_error('upload_file_partial', 'debug');
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
$this->set_error('upload_no_file_selected', 'debug');
|
||||
break;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
$this->set_error('upload_no_temp_directory', 'error');
|
||||
break;
|
||||
case UPLOAD_ERR_CANT_WRITE:
|
||||
$this->set_error('upload_unable_to_write_file', 'error');
|
||||
break;
|
||||
case UPLOAD_ERR_EXTENSION:
|
||||
$this->set_error('upload_stopped_by_extension', 'debug');
|
||||
break;
|
||||
default:
|
||||
$this->set_error('upload_no_file_selected', 'debug');
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Set the uploaded data as class variables
|
||||
$this->file_temp = $_file['tmp_name'];
|
||||
$this->file_size = $_file['size'];
|
||||
|
||||
// Skip MIME type detection?
|
||||
if ($this->detect_mime !== FALSE)
|
||||
{
|
||||
$this->_file_mime_type($_file);
|
||||
}
|
||||
|
||||
$this->file_type = preg_replace('/^(.+?);.*$/', '\\1', $this->file_type);
|
||||
$this->file_type = strtolower(trim(stripslashes($this->file_type), '"'));
|
||||
$this->file_name = $this->_prep_filename($_file['name']);
|
||||
$this->file_ext = $this->get_extension($this->file_name);
|
||||
$this->client_name = $this->file_name;
|
||||
|
||||
// Is the file type allowed to be uploaded?
|
||||
if ( ! $this->is_allowed_filetype())
|
||||
{
|
||||
$this->set_error('upload_invalid_filetype', 'debug');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// if we're overriding, let's now make sure the new name and type is allowed
|
||||
if ($this->_file_name_override !== '')
|
||||
{
|
||||
$this->file_name = $this->_prep_filename($this->_file_name_override);
|
||||
|
||||
// If no extension was provided in the file_name config item, use the uploaded one
|
||||
if (strpos($this->_file_name_override, '.') === FALSE)
|
||||
{
|
||||
$this->file_name .= $this->file_ext;
|
||||
}
|
||||
else
|
||||
{
|
||||
// An extension was provided, let's have it!
|
||||
$this->file_ext = $this->get_extension($this->_file_name_override);
|
||||
}
|
||||
|
||||
if ( ! $this->is_allowed_filetype(TRUE))
|
||||
{
|
||||
$this->set_error('upload_invalid_filetype', 'debug');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the file size to kilobytes
|
||||
if ($this->file_size > 0)
|
||||
{
|
||||
$this->file_size = round($this->file_size/1024, 2);
|
||||
}
|
||||
|
||||
// Is the file size within the allowed maximum?
|
||||
if ( ! $this->is_allowed_filesize())
|
||||
{
|
||||
$this->set_error('upload_invalid_filesize', 'info');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Are the image dimensions within the allowed size?
|
||||
// Note: This can fail if the server has an open_basedir restriction.
|
||||
if ( ! $this->is_allowed_dimensions())
|
||||
{
|
||||
$this->set_error('upload_invalid_dimensions', 'info');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Sanitize the file name for security
|
||||
$this->file_name = $this->_CI->security->sanitize_filename($this->file_name);
|
||||
|
||||
// Truncate the file name if it's too long
|
||||
if ($this->max_filename > 0)
|
||||
{
|
||||
$this->file_name = $this->limit_filename_length($this->file_name, $this->max_filename);
|
||||
}
|
||||
|
||||
// Remove white spaces in the name
|
||||
if ($this->remove_spaces === TRUE)
|
||||
{
|
||||
$this->file_name = preg_replace('/\s+/', '_', $this->file_name);
|
||||
}
|
||||
|
||||
if ($this->file_ext_tolower && ($ext_length = strlen($this->file_ext)))
|
||||
{
|
||||
// file_ext was previously lower-cased by a get_extension() call
|
||||
$this->file_name = substr($this->file_name, 0, -$ext_length).$this->file_ext;
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate the file name
|
||||
* This function appends an number onto the end of
|
||||
* the file if one with the same name already exists.
|
||||
* If it returns false there was a problem.
|
||||
*/
|
||||
$this->orig_name = $this->file_name;
|
||||
if (FALSE === ($this->file_name = $this->set_filename($this->upload_path, $this->file_name)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run the file through the XSS hacking filter
|
||||
* This helps prevent malicious code from being
|
||||
* embedded within a file. Scripts can easily
|
||||
* be disguised as images or other file types.
|
||||
*/
|
||||
if ($this->xss_clean && $this->do_xss_clean() === FALSE)
|
||||
{
|
||||
$this->set_error('upload_unable_to_write_file', 'error');
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Move the file to the final destination
|
||||
* To deal with different server configurations
|
||||
* we'll attempt to use copy() first. If that fails
|
||||
* we'll use move_uploaded_file(). One of the two should
|
||||
* reliably work in most environments
|
||||
*/
|
||||
if ( ! @copy($this->file_temp, $this->upload_path.$this->file_name))
|
||||
{
|
||||
if ( ! @move_uploaded_file($this->file_temp, $this->upload_path.$this->file_name))
|
||||
{
|
||||
$this->set_error('upload_destination_error', 'error');
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the finalized image dimensions
|
||||
* This sets the image width/height (assuming the
|
||||
* file was an image). We use this information
|
||||
* in the "data" function.
|
||||
*/
|
||||
$this->set_image_properties($this->upload_path.$this->file_name);
|
||||
|
||||
$thumb_path = str_replace("/files/","/thumbs/",$this->upload_path);
|
||||
|
||||
|
||||
if (!is_dir($thumb_path)) {
|
||||
mkdir($thumb_path, 0777, true);
|
||||
}
|
||||
|
||||
// exit();
|
||||
$this->make_thumb($this->upload_path.$this->file_name, $thumb_path.$this->file_name , 300);
|
||||
// exit();
|
||||
// echo "<pre>";
|
||||
// var_dump($this);
|
||||
// exit();
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
function make_thumb($originalFile,$targetFile,$newWidth) {
|
||||
|
||||
$info = getimagesize($originalFile);
|
||||
$mime = $info['mime'];
|
||||
|
||||
switch ($mime) {
|
||||
case 'image/jpeg':
|
||||
$image_create_func = 'imagecreatefromjpeg';
|
||||
$image_save_func = 'imagejpeg';
|
||||
$new_image_ext = 'jpg';
|
||||
break;
|
||||
|
||||
case 'image/png':
|
||||
$image_create_func = 'imagecreatefrompng';
|
||||
$image_save_func = 'imagepng';
|
||||
$new_image_ext = 'png';
|
||||
break;
|
||||
|
||||
case 'image/gif':
|
||||
$image_create_func = 'imagecreatefromgif';
|
||||
$image_save_func = 'imagegif';
|
||||
$new_image_ext = 'gif';
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception('Unknown image type.');
|
||||
}
|
||||
|
||||
$img = $image_create_func($originalFile);
|
||||
list($width, $height) = getimagesize($originalFile);
|
||||
|
||||
$newHeight = ($height / $width) * $newWidth;
|
||||
$tmp = imagecreatetruecolor($newWidth, $newHeight);
|
||||
|
||||
$background = imagecolorallocate($tmp, 255, 255, 255);
|
||||
// removing the black from the placeholder
|
||||
@imagecolortransparent($tmp, $background);
|
||||
// turning off alpha blending (to ensure alpha channel information is preserved, rather than removed (blending with the rest of the image in the form of black))
|
||||
@imagealphablending($tmp, false);
|
||||
// turning on alpha channel information saving (to ensure the full range of transparency is preserved)
|
||||
@imagesavealpha($tmp, true);
|
||||
|
||||
|
||||
|
||||
imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
|
||||
|
||||
|
||||
imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
|
||||
|
||||
if (file_exists($targetFile)) {
|
||||
unlink($targetFile);
|
||||
}
|
||||
$image_save_func($tmp, $targetFile);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user