first commit
This commit is contained in:
55
application/core/CM_Controller.php
Executable file
55
application/core/CM_Controller.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
class MY_Controller extends CI_Controller
|
||||
{
|
||||
protected $adminViewFolder = 'adm/';
|
||||
protected $categories;
|
||||
protected $request;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
if (strpos($this->uri->segment(1), 'adm') !== false && $this->session->userdata('Adm_Id') == '') {
|
||||
header('location: /admin');
|
||||
exit(3);
|
||||
}
|
||||
$this->categories = $this->config->item('categories');
|
||||
$this->load->model('category_model');
|
||||
}
|
||||
|
||||
public function getRequest($contentType = 'json')
|
||||
{
|
||||
if (!$this->request) {
|
||||
$this->request = new stdClass;
|
||||
if ($contentType == 'json') {
|
||||
$this->request->body = json_decode(file_get_contents("php://input"), true);
|
||||
}
|
||||
parse_str($this->input->server('QUERY_STRING', null, ''), $this->request->param);
|
||||
if(!$this->param('limit')) $this->request->param['limit'] = 30;
|
||||
if(!$this->param('order')) $this->request->param['order'] = 'desc';
|
||||
}
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
public function param($key = null)
|
||||
{
|
||||
return $key ? (empty($this->getRequest()->body[$key]) ? (empty($this->request->param[$key]) ? null : $this->request->param[$key]) : $this->getRequest()->body[$key]) : $this->getRequest()->body;
|
||||
}
|
||||
|
||||
public function response($data = null, $code = 200, $message = 'Success', $contentType = 'application/json')
|
||||
{
|
||||
$data = array('code' => $code, 'message' => $message, 'data' => $data);
|
||||
if ($contentType == 'application/json') {
|
||||
$this->output
|
||||
->set_content_type($contentType)
|
||||
->set_output(json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
public function getSubCategoryId($parentCategoryName = 'grace-category')
|
||||
{
|
||||
$subCategoryId = $this->category_model->getSubCategoryId($parentCategoryName);
|
||||
return array_merge(array_values($this->categories[explode('-', $parentCategoryName)[0]]), $subCategoryId['subcategories']);
|
||||
}
|
||||
}
|
||||
22
application/core/CM_Model.php
Executable file
22
application/core/CM_Model.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class MY_Model extends CI_Model
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->database();
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('CM_Model')) {
|
||||
class CM_Model extends MY_Model
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
}
|
||||
58
application/core/admin/cm_controller.php
Executable file
58
application/core/admin/cm_controller.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
ini_set('max_execution_time', 120);
|
||||
/**
|
||||
* PURPOSE Controller에서 공통 함수 호출을 위해 Class 확장
|
||||
*/
|
||||
class cm_controller extends CI_Controller {
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
$this->load->library('user_agent');
|
||||
$this->load->helper('crossmap/tool_helper');
|
||||
$this->load->helper('crossmap/exception_helper');
|
||||
|
||||
if($this->session->userdata('Adm_Id') == '') {
|
||||
gf_alert('잘못된 접근입니다.', '/admin/');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function _remap($method, $params = array()) {
|
||||
# model - header 이미지
|
||||
$this->load->model('admin/setting/m_setting_site');
|
||||
$return_data = $this->m_setting_site->site_info_select();
|
||||
if($return_data == '') {
|
||||
$return_data['admin_logo'] = '';
|
||||
}
|
||||
|
||||
// Method가 있으면 해당 함수 실행
|
||||
if (method_exists($this, 'fn_'.$method)) {
|
||||
// Skin
|
||||
$data['Skin_Header'] = $this->load->view('skin/admin/_header', $return_data, TRUE);
|
||||
$data['Skin_Footer'] = $this->load->view('skin/admin/_footer', '', TRUE);
|
||||
|
||||
$data['Skin_Content'] = call_user_func_array(array($this, 'fn_'.$method), $params);
|
||||
|
||||
$this->load->view('skin/admin/_body', $data);
|
||||
|
||||
} else if (method_exists($this, 'fn_popup_'.$method)) {
|
||||
// Skin
|
||||
$data['Skin_Header'] = '';
|
||||
$data['Skin_Footer'] = '';
|
||||
$data['Skin_Content'] = call_user_func_array(array($this, 'fn_popup_'.$method), $params);
|
||||
|
||||
$this->load->view('skin/admin/_body', $data);
|
||||
|
||||
} else if (method_exists($this, 'fn_ajax_'.$method)) { // Ajax페이지는 Skin 필요없음
|
||||
call_user_func_array(array($this, 'fn_ajax_'.$method), $params);
|
||||
} else if (method_exists($this, 'fn_doc_'.$method)) { // Skin 필요없음
|
||||
call_user_func_array(array($this, 'fn_doc_'.$method), $params);
|
||||
} else { // 없으면 잘못된 URL
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
application/core/index.html
Executable file
11
application/core/index.html
Executable file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
201
application/core/m/cm_controller.php
Executable file
201
application/core/m/cm_controller.php
Executable file
@@ -0,0 +1,201 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
/**
|
||||
* PURPOSE Controller에서 공통 함수 호출을 위해 Class 확장
|
||||
*/
|
||||
|
||||
include_once(APPPATH . 'core/m/cm_exceptions.php');
|
||||
|
||||
class cm_controller extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
$this->load->library('user_agent');
|
||||
$this->load->helper('crossmap/tool_helper');
|
||||
$this->load->helper('crossmap/exception_helper');
|
||||
|
||||
}
|
||||
|
||||
function _remap($method, $params = array())
|
||||
{
|
||||
|
||||
$this->load->helper('cookie');
|
||||
$session_id = get_cookie('crossmap_save_id');
|
||||
# session
|
||||
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
||||
|
||||
$config = Array(
|
||||
'protocol' => 'smtp',
|
||||
'smtp_host' => 'ssl://smtp.googlemail.com',
|
||||
'smtp_port' => 465,
|
||||
'smtp_user' => CROSSMAP_EMAIL_ID,
|
||||
'smtp_pass' => CROSSMAP_EMAIL_PASSWORD,
|
||||
'mailtype' => 'html',
|
||||
'charset' => 'utf-8'
|
||||
);
|
||||
|
||||
|
||||
$this->load->library('email',$config);
|
||||
$this->email->set_newline("\r\n");
|
||||
|
||||
|
||||
|
||||
if ($session_id != '' && $SES_MEMBER_ID == '') {
|
||||
# model - session 가져오기
|
||||
$this->load->model('web/m_ci_sessions');
|
||||
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
|
||||
session_decode($session_result['data']);
|
||||
}
|
||||
|
||||
if ($SES_MEMBER_ID != '') {
|
||||
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
|
||||
|
||||
# model - 중복로그인 체크용
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $SES_MEMBER_ID;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
$req_data['expire_date'] = $expire_date;
|
||||
$this->load->model('web/m_member_login');
|
||||
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
|
||||
}
|
||||
|
||||
$this->load->model('web/m_site_info');
|
||||
$site_info = $this->m_site_info->site_info_select(1);
|
||||
|
||||
|
||||
// Method가 있으면 해당 함수 실행
|
||||
if (method_exists($this, 'fn_' . $method)) {
|
||||
$data = array();
|
||||
|
||||
$data['Skin_Content'] = call_user_func_array(array($this, 'fn_' . $method), $params);
|
||||
|
||||
|
||||
$arr_content = array();
|
||||
$content_idx = $this->uri->segment(4);
|
||||
|
||||
|
||||
$return_data = array();
|
||||
$return_data['site_info'] = $site_info;
|
||||
$return_data['arr_content'] = $arr_content;
|
||||
|
||||
$skin_header_url = 'skin/m/_header';
|
||||
$skin_footer_url = 'skin/m/_footer';
|
||||
$skin_body_url = 'skin/m/_body';
|
||||
|
||||
|
||||
$body_class = "news";
|
||||
|
||||
$controller = $this->uri->segment(2);
|
||||
|
||||
if($controller == 'search' || $controller == 'life' || $controller == 'cmtv' || $controller == '' || $controller == 'rules' || $controller == 'main2'){
|
||||
|
||||
$skin_header_url = 'skin/m/news/_header';
|
||||
$skin_body_url = 'skin/m/news/_body';
|
||||
$skin_footer_url = 'skin/m/news/_footer';
|
||||
|
||||
if($method == 'image_view')
|
||||
{
|
||||
$skin_footer_url = 'skin/m/_null';
|
||||
$skin_header_url = 'skin/m/_null';
|
||||
$skin_body_url = 'skin/m/_body';
|
||||
$body_class = "photos";
|
||||
|
||||
}
|
||||
|
||||
if($controller == 'rules'){
|
||||
$body_class = "mypage";
|
||||
// $skin_footer_url = "skin/m/_null";
|
||||
}
|
||||
|
||||
if($controller == ''){
|
||||
$skin_header_url = 'skin/m/_null';
|
||||
}
|
||||
|
||||
}
|
||||
else if($controller == 'news'){
|
||||
$skin_header_url = 'skin/m/news/_header';
|
||||
$skin_body_url = 'skin/m/news/_body';
|
||||
$skin_footer_url = 'skin/m/news/_footer';
|
||||
|
||||
}else{
|
||||
switch ($method) {
|
||||
|
||||
|
||||
|
||||
case "news_view":
|
||||
$skin_header_url = 'skin/m/news/_header';
|
||||
$skin_body_url = 'skin/m/news/_body';
|
||||
$skin_footer_url = 'skin/m/news/_footer';
|
||||
break;
|
||||
case "login":
|
||||
case "join":
|
||||
case "join_1":
|
||||
case "join_2":
|
||||
$body_class = "mypage";
|
||||
$skin_body_url = 'skin/m/_body';
|
||||
$skin_footer_url = 'skin/m/_null';
|
||||
break;
|
||||
|
||||
case "notice":
|
||||
case "faq":
|
||||
case "mtm":
|
||||
case "faq_view":
|
||||
case "life_view":
|
||||
case "qna":
|
||||
case "qna_view":
|
||||
case "qna_add":
|
||||
case "bookmark":
|
||||
case "delivery":
|
||||
case "bookmark":
|
||||
case "req_password":
|
||||
case "member_edit":
|
||||
case "user_comment":
|
||||
$body_class = "mypage";
|
||||
$skin_header_url = 'skin/m/news/_header';
|
||||
$skin_body_url = 'skin/m/_body';
|
||||
break;
|
||||
case "find_id":
|
||||
case "find_pw":
|
||||
case "find_id_with_email":
|
||||
case "find_pw_with_email":
|
||||
case "secession":
|
||||
case "image_view":
|
||||
case "change_pw":
|
||||
case "change_pw2":
|
||||
|
||||
$body_class = "mypage";
|
||||
$skin_footer_url = 'skin/m/_null';
|
||||
$skin_header_url = 'skin/m/_null';
|
||||
$skin_body_url = 'skin/m/_body';
|
||||
|
||||
break;
|
||||
default:
|
||||
$skin_header_url = 'skin/m/_null';
|
||||
$skin_footer_url = 'skin/m/_null';
|
||||
break;
|
||||
}
|
||||
}
|
||||
// var_dump($skin_header_url);
|
||||
$data['body_class'] = $body_class;
|
||||
$data['Skin_Header'] = $this->load->view($skin_header_url, $return_data, TRUE);
|
||||
$data['Skin_Footer'] = $this->load->view($skin_footer_url, $return_data, TRUE);
|
||||
|
||||
|
||||
// var_dump($data);
|
||||
$this->load->view($skin_body_url, $data);
|
||||
|
||||
|
||||
} else if (method_exists($this, 'fn_ajax_' . $method)) { // Ajax페이지는 Skin 필요없음
|
||||
call_user_func_array(array($this, 'fn_ajax_' . $method), $params);
|
||||
} else if (method_exists($this, 'fn_nonskin_' . $method)) {
|
||||
call_user_func_array(array($this, 'fn_nonskin_' . $method), $params);
|
||||
|
||||
} else { // 없으면 잘못된 URL
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
application/core/m/cm_exceptions.php
Executable file
24
application/core/m/cm_exceptions.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<? if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Cm_Exception extends Exception {
|
||||
|
||||
public function __construct($type, $code, $msg) {
|
||||
|
||||
if($type=='json') {
|
||||
header("Content-Type: application/json");
|
||||
|
||||
$arr = array();
|
||||
$arr = array('code' => $code, 'msg' => $msg);
|
||||
|
||||
echo json_encode($arr);
|
||||
exit;
|
||||
} else if($type=='html') {
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
echo $code.'|||||'.$msg;
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
110
application/core/web/cm_controller.php
Executable file
110
application/core/web/cm_controller.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?php defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
include_once(APPPATH.'core/web/cm_exceptions.php');
|
||||
class cm_controller extends CI_Controller {
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
$this->load->library('user_agent');
|
||||
$this->load->helper('crossmap/tool_helper');
|
||||
$this->load->helper('crossmap/exception_helper');
|
||||
|
||||
}
|
||||
|
||||
function _remap($method, $params = array()) {
|
||||
|
||||
|
||||
$this->load->helper('cookie');
|
||||
$session_id = get_cookie('crossmap_save_id');
|
||||
# session
|
||||
$SES_MEMBER_ID = $this->session->userdata('C_Member_Id');
|
||||
if($session_id != '' && $SES_MEMBER_ID=='') {
|
||||
# model - session 가져오기
|
||||
$this->load->model('web/m_ci_sessions');
|
||||
$session_result = $this->m_ci_sessions->ci_sessions_select($session_id);
|
||||
session_decode($session_result['data']);
|
||||
}
|
||||
|
||||
if($SES_MEMBER_ID!='') {
|
||||
$expire_date = date("Y-m-d H:i:s", strtotime("+10 minutes"));
|
||||
|
||||
# model - 중복로그인 체크용
|
||||
$req_data = array();
|
||||
$req_data['member_id'] = $SES_MEMBER_ID;
|
||||
$req_data['member_ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
$req_data['expire_date'] = $expire_date;
|
||||
$this->load->model('web/m_member_login');
|
||||
$this->m_member_login->member_login_member_id_member_ip_update($req_data);
|
||||
}
|
||||
|
||||
|
||||
# model - 사이트 정보
|
||||
$this->load->model('web/m_site_info');
|
||||
$site_info = $this->m_site_info->site_info_select(1);
|
||||
|
||||
$controller = $this->uri->segment(2);
|
||||
|
||||
|
||||
// Method가 있으면 해당 함수 실행
|
||||
if (method_exists($this, 'fn_'.$method)) {
|
||||
$data = array();
|
||||
$data['Skin_Content'] = call_user_func_array(array($this, 'fn_'.$method), $params);
|
||||
|
||||
$arr_content = array();
|
||||
$content_idx = $this->uri->segment(4);
|
||||
if($method=='news_view') {
|
||||
$this->load->model('web/m_news');
|
||||
$arr_content = $this->m_news->news_select_idx($content_idx);
|
||||
} else if($method=='column_view') {
|
||||
$this->load->model('web/m_column');
|
||||
$arr_content = $this->m_column->column_select($content_idx);
|
||||
} else if($method=='life_view') {
|
||||
$this->load->model('web/m_life');
|
||||
$arr_content = $this->m_life->life_select_idx($content_idx);
|
||||
}
|
||||
|
||||
$return_data = array();
|
||||
$return_data['site_info'] = $site_info;
|
||||
$return_data['arr_content'] = $arr_content;
|
||||
|
||||
$skin_header_url = 'skin/web/_header';
|
||||
$skin_footer_url = 'skin/web/_footer';
|
||||
$skin_body_url = 'skin/web/_body';
|
||||
if($controller =='mypage' || $controller =='cs' || $controller =='rules') {
|
||||
$skin_header_url = 'skin/web/mypage/_header';
|
||||
$data['Skin_Left'] = $this->load->view('skin/web/mypage/_left', $return_data, true);
|
||||
$skin_body_url = 'skin/web/mypage/_body';
|
||||
|
||||
} else {
|
||||
if($method == 'channel_recommend' || ($controller == 'life' && ($method == 'category' || $method=='tag'))) { // 추천채널
|
||||
$skin_header_url = 'skin/web/life/_header_simple';
|
||||
$skin_body_url = 'skin/web/life/_body';
|
||||
|
||||
} else if($method == 'life_view' || $method == 'life_comment' || $method == 'channel' || $method == 'editor') {
|
||||
$skin_header_url = '';
|
||||
$skin_body_url = 'skin/web/life/_body';
|
||||
}
|
||||
}
|
||||
|
||||
if($controller =='maptoon') {
|
||||
$skin_header_url = 'skin/web/maptoon/_header_simple';
|
||||
$skin_body_url = 'skin/web/maptoon/_body';
|
||||
$skin_footer_url = 'skin/web/maptoon/_footer';
|
||||
}
|
||||
|
||||
$data['Skin_Header'] = '';
|
||||
if ($skin_header_url!='') $data['Skin_Header'] = $this->load->view($skin_header_url, $return_data, TRUE);
|
||||
$data['Skin_Footer'] = $this->load->view($skin_footer_url, $return_data, TRUE);
|
||||
$this->load->view($skin_body_url, $data);
|
||||
|
||||
} else if (method_exists($this, 'fn_ajax_'.$method)) { // Ajax페이지는 Skin 필요없음
|
||||
call_user_func_array(array($this, 'fn_ajax_'.$method), $params);
|
||||
} else if (method_exists($this, 'fn_nonskin_'.$method)) {
|
||||
call_user_func_array(array($this, 'fn_nonskin_'.$method), $params);
|
||||
|
||||
} else { // 없으면 잘못된 URL
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
application/core/web/cm_exceptions.php
Executable file
24
application/core/web/cm_exceptions.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<? if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Cm_Exception extends Exception {
|
||||
|
||||
public function __construct($type, $code, $msg) {
|
||||
|
||||
if($type=='json') {
|
||||
header("Content-Type: application/json");
|
||||
|
||||
$arr = array();
|
||||
$arr = array('code' => $code, 'msg' => $msg);
|
||||
|
||||
echo json_encode($arr);
|
||||
exit;
|
||||
} else if($type=='html') {
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
echo $code.'|||||'.$msg;
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user