Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
73
application/controllers/admin/Main.php
Normal file
73
application/controllers/admin/Main.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Main class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자 메인 controller 입니다.
|
||||
*/
|
||||
class Main extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = '';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array();
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = '';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 메인 페이지입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
$view['view']['latest_user'] = $this->User_model->get_admin_list(7, '', '', '', 'user_id', 'desc', '', '');
|
||||
if (isset($view['view']['latest_user']['list']) && is_array($view['view']['latest_user']['list'])) {
|
||||
foreach ($view['view']['latest_user']['list'] as $key => $val) {
|
||||
$view['view']['latest_user']['list'][$key]['display_name'] = display_username(
|
||||
element('user_username', $val)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'main');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
}
|
||||
168
application/controllers/admin/apis/Apidocument.php
Normal file
168
application/controllers/admin/apis/Apidocument.php
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Apidocument class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>Api 관리>Api 문서보기 controller 입니다.
|
||||
*/
|
||||
class Apidocument extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'apis/apidocument';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Api_error_log', 'Api_input', 'Api_list', 'Api_output');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Api_list_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring', 'apilib'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 메인페이지입니다 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
$menu = $this->_menu();
|
||||
|
||||
$view['view']['data'] = $menu;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout_api', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$view['layout']['menu'] = $menu;
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 뷰페이지입니다 메소드입니다
|
||||
*/
|
||||
public function view($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->Api_list_model->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
|
||||
$getdata = $this->Api_list_model->get_one($pid);
|
||||
|
||||
// input data
|
||||
$input = $this->Api_input_model->get('', '', $where = array('api_idx' => $pid), '', 0, 'ai_sort', 'asc');
|
||||
|
||||
// output data
|
||||
$output = $this->Api_output_model->get('', '', $where = array('api_idx' => $pid), '', 0, 'ai_sort', 'asc');
|
||||
|
||||
} else {
|
||||
show_404();
|
||||
}
|
||||
|
||||
$menu = $this->_menu();
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
$view['view']['input'] = $input;
|
||||
$view['view']['output'] = $output;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout_api', 'skin' => 'view');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$view['layout']['menu'] = $menu;
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
public function emptypage()
|
||||
{
|
||||
echo '실행하여주세요';
|
||||
}
|
||||
|
||||
|
||||
public function xml($api_idx)
|
||||
{
|
||||
if (! $api_idx) show_404();
|
||||
$getdata = $this->Api_list_model->get_one($api_idx);
|
||||
if (! element('api_idx', $getdata)) show_404();
|
||||
echo $this->apilib->callapi($getdata, 'xml');
|
||||
}
|
||||
|
||||
public function json($api_idx)
|
||||
{
|
||||
if (! $api_idx) show_404();
|
||||
$getdata = $this->Api_list_model->get_one($api_idx);
|
||||
if (! element('api_idx', $getdata)) show_404();
|
||||
echo $this->apilib->callapi($getdata, 'json');
|
||||
}
|
||||
|
||||
public function json2($api_idx)
|
||||
{
|
||||
if (! $api_idx) show_404();
|
||||
$getdata = $this->Api_list_model->get_one($api_idx);
|
||||
if (! element('api_idx', $getdata)) show_404();
|
||||
echo $this->apilib->callapi($getdata, 'json2');
|
||||
}
|
||||
|
||||
public function _menu()
|
||||
{
|
||||
$menu = $this->Api_list_model->get('', '', $where = array('api_use' => '1'), '', 0, 'api_name', 'asc');
|
||||
return $menu;
|
||||
}
|
||||
}
|
||||
|
||||
614
application/controllers/admin/apis/Apimanage.php
Normal file
614
application/controllers/admin/apis/Apimanage.php
Normal file
@@ -0,0 +1,614 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Apimanage class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>Api 관리>Api 관리 controller 입니다.
|
||||
*/
|
||||
class Apimanage extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'apis/apimanage';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Api_error_log', 'Api_input', 'Api_list', 'Api_output');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Api_list_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : 'api_name';
|
||||
$forder = $this->input->get('forder', null, 'asc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = 50;
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('api_idx', 'api_name', 'api_exp', 'api_url', 'api_bigo'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('api_idx'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('api_idx', 'api_name'); // 정렬이 가능한 필드
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, '', '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('api_name' => '이름', 'api_method' => '호출방식', 'api_exp' => '설명', 'api_bigo' => '비고');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'api_name',
|
||||
'label' => 'API 이름',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'api_exp',
|
||||
'label' => '내용',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'api_method',
|
||||
'label' => '호출방식',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'api_use',
|
||||
'label' => '사용여부',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'api_bigo',
|
||||
'label' => '비고',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = array(
|
||||
'api_name' => $this->input->post('api_name', null, ''),
|
||||
'api_exp' => $this->input->post('api_exp', null, ''),
|
||||
'api_method' => $this->input->post('api_method', null, ''),
|
||||
'api_use' => $this->input->post('api_use', null, ''),
|
||||
'api_bigo' => $this->input->post('api_bigo', null, ''),
|
||||
);
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
$this->{$this->modelname}->update($this->input->post($primary_key), $updatedata);
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 수정되었습니다'
|
||||
);
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('write');
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
$this->{$this->modelname}->insert($updatedata);
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 입력되었습니다'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$outdata = $this->Api_output_model->get_one('', '', array('api_idx', $val));
|
||||
if (element('ai_idx', $outdata)) {
|
||||
alert('Input 및 Output 변수를 먼저 삭제하신 후에 삭제가 가능합니다.');
|
||||
}
|
||||
$indata = $this->Api_input_model->get_one('', '', array('api_idx', $val));
|
||||
if (element('ai_idx', $indata)) {
|
||||
alert('Input 및 Output 변수를 먼저 삭제하신 후에 삭제가 가능합니다.');
|
||||
}
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function argumentlist($type = '', $api_idx = '')
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
if ($type != 'output') $type = 'input';
|
||||
$view['view']['type'] = $type;
|
||||
|
||||
if (! $api_idx) show_404();
|
||||
if ( ! is_numeric($api_idx)) show_404();
|
||||
|
||||
$view['view']['apidata'] = $apidata = $this->Api_list_model->get_one($api_idx);
|
||||
if ( ! element('api_idx', $apidata)) show_404();
|
||||
|
||||
$modelname = $type == 'output' ? 'Api_output_model' : 'Api_input_model';
|
||||
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : 'ai_sort';
|
||||
$forder = $this->input->get('forder', null, 'asc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = 100;
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$modelname}->allow_search_field = array('ai_idx', 'ai_name', 'ai_type', 'ai_ness', 'ai_exp', 'ai_sort', 'api_bigo'); // 검색이 가능한 필드
|
||||
$this->{$modelname}->search_field_equal = array('ai_idx'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$modelname}->allow_order_field = array('ai_idx', 'ai_name', 'ai_sort'); // 정렬이 가능한 필드
|
||||
$where = array(
|
||||
'api_idx' => $api_idx,
|
||||
);
|
||||
$result = $this->{$modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('ai_name' => '변수명', 'ai_type' => '타입', 'ai_ness' => '종류', 'ai_exp' => '설명', 'ai_sort' => '순서');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['input_list_url'] = admin_url($this->pagedir . '/argumentlist/input/' . $api_idx);
|
||||
$view['view']['output_list_url'] = admin_url($this->pagedir . '/argumentlist/output/' . $api_idx);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/argumentwrite/' . $type . '/' . $api_idx);
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/argumentlistdelete/' . $type . '/' . $api_idx . '?' . $param->output());
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'argumentlist');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function argumentwrite($type = '', $api_idx = '', $pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
if ($type != 'output') $type = 'input';
|
||||
$view['view']['type'] = $type;
|
||||
|
||||
if (! $api_idx) show_404();
|
||||
if ( ! is_numeric($api_idx)) show_404();
|
||||
$modelname = $type == 'output' ? 'Api_output_model' : 'Api_input_model';
|
||||
|
||||
$view['view']['apidata'] = $apidata = $this->Api_list_model->get_one($api_idx);
|
||||
if ( ! element('api_idx', $apidata)) show_404();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$modelname}->get_one($pid);
|
||||
} else {
|
||||
$max_sort = $this->{$modelname}->select_max_sort($api_idx);
|
||||
$getdata['ai_sort'] = $max_sort + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'api_idx',
|
||||
'label' => 'API IDX',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'ai_name',
|
||||
'label' => '내용',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'ai_type',
|
||||
'label' => '타입',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'ai_ness',
|
||||
'label' => '종류',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'ai_exp',
|
||||
'label' => '설명',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'ai_sort',
|
||||
'label' => '순서',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
$view['view']['input_list_url'] = admin_url($this->pagedir . '/argumentlist/input/' . $api_idx);
|
||||
$view['view']['output_list_url'] = admin_url($this->pagedir . '/argumentlist/output/' . $api_idx);
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'argumentwrite');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = array(
|
||||
'api_idx' => $this->input->post('api_idx', null, ''),
|
||||
'ai_name' => $this->input->post('ai_name', null, ''),
|
||||
'ai_type' => $this->input->post('ai_type', null, ''),
|
||||
'ai_ness' => $this->input->post('ai_ness', null, ''),
|
||||
'ai_exp' => $this->input->post('ai_exp', null, ''),
|
||||
'ai_sort' => $this->input->post('ai_sort', null, ''),
|
||||
);
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
$this->{$modelname}->update($this->input->post($primary_key), $updatedata);
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 수정되었습니다'
|
||||
);
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('write');
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
$this->{$modelname}->update_sort($this->input->post('api_idx', null, ''), $this->input->post('ai_sort', null, ''));
|
||||
$this->{$modelname}->insert($updatedata);
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
$this->input->post('ai_name', null, '') . '변수명이 등록되었습니다'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
if ($this->input->post('reinput')) {
|
||||
$redirecturl = admin_url($this->pagedir . '/argumentwrite/' . $type . '/' . $api_idx . '?' . $param->output());
|
||||
} else {
|
||||
$redirecturl = admin_url($this->pagedir . '/argumentlist/' . $type . '/' . $api_idx . '?' . $param->output());
|
||||
}
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function argumentlistdelete($type = '', $api_idx = '')
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
if ($type != 'output') $type = 'input';
|
||||
|
||||
if (! $api_idx) show_404();
|
||||
if ( ! is_numeric($api_idx)) show_404();
|
||||
$modelname = $type == 'output' ? 'Api_output_model' : 'Api_input_model';
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->{$modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '/argumentlist/' . $type . '/' . $api_idx . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
358
application/controllers/admin/appmanage/Appcats.php
Normal file
358
application/controllers/admin/appmanage/Appcats.php
Normal file
@@ -0,0 +1,358 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Appcats class
|
||||
*/
|
||||
|
||||
class Appcats extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'appmanage/appcats';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Contents_category', 'Upload_file', 'Apps');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Contents_category_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'dhtml_editor');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
|
||||
$app_id = $this->input->get('app_id');
|
||||
|
||||
if ($app_id) {
|
||||
$where = array(
|
||||
'cat_parent' => '0',
|
||||
'app_id' => $app_id,
|
||||
);
|
||||
$result = $this->{$this->modelname}->get('', '', $where, '', '', 'cat_sort', 'desc');
|
||||
$view['view']['data'] = $result;
|
||||
}
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($app_id = 0, $pid = 0)
|
||||
{
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'cat_code',
|
||||
'label' => '분류코드',
|
||||
'rules' => 'trim|required|alpha_numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'cat_name',
|
||||
'label' => '카테고리명',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'cat_parent',
|
||||
'label' => 'Parent',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'cat_sort',
|
||||
'label' => '정렬순서',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
$parent = '';
|
||||
if ($cat_parent = (int) $this->input->get('cat_parent') OR $cat_parent = element('cat_parent', $getdata)) {
|
||||
$pwhere = array(
|
||||
'app_id' => $app_id,
|
||||
'cat_id' => $cat_parent,
|
||||
);
|
||||
$parent = $this->{$this->modelname}->get_one('', '', $pwhere);
|
||||
if ( ! element('cat_id', $parent)) {
|
||||
alert_close('잘못된 접근입니다.');
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
$view['view']['parent'] = $parent;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout_popup', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$uniqwhere = array(
|
||||
'app_id' => $app_id,
|
||||
'cat_code' => $this->input->post('cat_code'),
|
||||
'cat_id <>' => $this->input->post($primary_key),
|
||||
);
|
||||
$uniqcheck = $this->{$this->modelname}->get_one('', '', $uniqwhere);
|
||||
if (element('cat_id', $uniqcheck)) {
|
||||
alert('중복된 코드가 존재합니다.');
|
||||
}
|
||||
|
||||
$updatedata = array(
|
||||
'cat_code' => $this->input->post('cat_code'),
|
||||
'cat_name' => $this->input->post('cat_name'),
|
||||
'cat_sort' => $this->input->post('cat_sort'),
|
||||
'cat_publish_time' => $this->input->post('cat_publish_time'),
|
||||
);
|
||||
|
||||
|
||||
$this->{$this->modelname}->update($this->input->post($primary_key), $updatedata);
|
||||
$cat_parent = (int) $this->input->post('cat_parent');
|
||||
|
||||
alert_refresh_close('정상적으로 수정되었습니다', admin_url('appmanage/appcats?app_id=' . $app_id . '&cat1_id=' . $cat_parent));
|
||||
|
||||
} else {
|
||||
|
||||
$uniqwhere = array(
|
||||
'app_id' => $app_id,
|
||||
'cat_code' => $this->input->post('cat_code'),
|
||||
);
|
||||
$uniqcheck = $this->{$this->modelname}->get_one('', '', $uniqwhere);
|
||||
if (element('cat_id', $uniqcheck)) {
|
||||
alert('중복된 코드가 존재합니다.');
|
||||
}
|
||||
|
||||
$cat_parent = (int) $this->input->post('cat_parent');
|
||||
|
||||
if ($cat_parent) {
|
||||
$pwhere = array(
|
||||
'app_id' => $app_id,
|
||||
'cat_id' => $cat_parent,
|
||||
);
|
||||
$parent = $this->{$this->modelname}->get_one('', '', $pwhere);
|
||||
if ( ! element('cat_id', $parent)) {
|
||||
alert_close('잘못된 접근입니다.');
|
||||
}
|
||||
$cat_depth = element('cat_depth', $parent) + 1;
|
||||
} else {
|
||||
$cat_depth = 1;
|
||||
}
|
||||
|
||||
$updatedata = array(
|
||||
'app_id' => $app_id,
|
||||
'cat_parent' => $cat_parent,
|
||||
'cat_depth' => $cat_depth,
|
||||
'cat_code' => $this->input->post('cat_code'),
|
||||
'cat_name' => $this->input->post('cat_name'),
|
||||
'cat_sort' => $this->input->post('cat_sort'),
|
||||
'cat_publish_time' => $this->input->post('cat_publish_time'),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
$insert_id = $this->{$this->modelname}->insert($updatedata);
|
||||
|
||||
alert_refresh_close('정상적으로 입력되었습니다', admin_url('appmanage/appcats?app_id=' . $app_id . '&cat1_id=' . $cat_parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getcategory($app_id= '', $parent_id = '', $depth = '')
|
||||
{
|
||||
if ( ! $app_id) show_404();
|
||||
if ( ! $parent_id) show_404();
|
||||
if ( ! $depth) show_404();
|
||||
if ($depth != '2' && $depth != '3' && $depth != '4') show_404();
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
$where = array(
|
||||
'app_id' => $app_id,
|
||||
'cat_parent' => $parent_id,
|
||||
'cat_depth' => $depth,
|
||||
);
|
||||
$result = $this->{$this->modelname}->get('', '', $where, '', '', 'cat_sort', 'desc');
|
||||
|
||||
$nextdepth = $depth + 1;
|
||||
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
$html = '<div class="list-group"><li class="list-group-item active">';
|
||||
$cattitle = '';
|
||||
if ($depth == '2') {
|
||||
$cattitle = '2차분류';
|
||||
}
|
||||
else if ($depth == '3') {
|
||||
$cattitle = '소분류';
|
||||
}
|
||||
else if ($depth == '4') {
|
||||
$cattitle = '세분류';
|
||||
}
|
||||
$html .= $cattitle . '<button type="button" class="btn btn-xs pull-right btn-default" onClick="add_category(\'' . $app_id . '\', \'' . $parent_id . '\');">추가</button></li>';
|
||||
|
||||
if ($result) {
|
||||
foreach ($result as $key => $value) {
|
||||
$html .= '<li class="list-group-item">';
|
||||
if ($nextdepth < 5) {
|
||||
$html .= '<a href="javascript:;" onclick="show_sub_category(\'' . $app_id . '\', \'' . element('cat_id', $value) . '\', \'' . $nextdepth . '\');">';
|
||||
}
|
||||
$html .= html_escape(element('cat_name', $value));
|
||||
if ($nextdepth < 5) {
|
||||
$html .= '</a>';
|
||||
}
|
||||
$html .= ' ('. html_escape(element('cat_code', $value)) . ')';
|
||||
$html .= '<span class="label label-default">' . element('cat_sort', $value) . '</span>';
|
||||
$html .= '<button type="button" class="btn btn-xs pull-right bg-olive" onClick="modify_category(\'' . $app_id . '\', \'' . $parent_id . '\', \'' . element('cat_id', $value) . '\');">수정</button></li>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</div>';
|
||||
|
||||
echo $html;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function delete($id='')
|
||||
{
|
||||
if ( ! $id) show_404();
|
||||
|
||||
$data = $this->{$this->modelname}->get_one($id);
|
||||
if ( ! element('app_id', $data)) {
|
||||
alert_close('잘못된 접근입니다.');
|
||||
}
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
$this->_recursiveDelete(element('app_id', $data), $id);
|
||||
alert_refresh_close('정상적으로 삭제되었습니다');
|
||||
}
|
||||
|
||||
public function _recursiveDelete($app_id, $id) {
|
||||
|
||||
$result=$this->{$this->modelname}->get('', '', array('app_id' => $app_id, 'cat_parent' => $id));
|
||||
if (count($result)) {
|
||||
foreach($result as $current) {
|
||||
$this->_recursiveDelete($app_id, element('cat_id', $current));
|
||||
}
|
||||
}
|
||||
$this->{$this->modelname}->delete($id);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
772
application/controllers/admin/appmanage/Apps.php
Normal file
772
application/controllers/admin/appmanage/Apps.php
Normal file
@@ -0,0 +1,772 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Apps class
|
||||
*/
|
||||
|
||||
class Apps extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'appmanage/apps';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Apps', 'Upload_file');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Apps_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'dhtml_editor');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : 'app_sort';
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('app_id','app_package','app_name'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('app_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('app_id', 'app_sort'); // 정렬이 가능한 필드
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, '', '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('app_id' => '고유번호','app_package' => '패키지명','app_name' => '어플 이름');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$view['view']['upload_file_count'] = $upload_file_count = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array('field' => 'app_package', 'label' => '패키지명', 'rules' => 'trim|required'),
|
||||
array('field' => 'app_name', 'label' => '어플 이름', 'rules' => 'trim|required'),
|
||||
array('field' => 'app_sort', 'label' => '정렬순서', 'rules' => 'trim|required'),
|
||||
array('field' => 'app_policy', 'label' => '개인정보취급방침', 'rules' => 'trim'),
|
||||
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
$form_validation = $this->form_validation->run();
|
||||
$file_error = '';
|
||||
|
||||
|
||||
$uploadfiledata = '';
|
||||
$uploadfiledata2 = '';
|
||||
if ($upload_file_count > 0 && $form_validation) {
|
||||
$this->load->library('upload');
|
||||
if (isset($_FILES) && isset($_FILES['upload_file']) && isset($_FILES['upload_file']['name']) && is_array($_FILES['upload_file']['name'])) {
|
||||
$filecount = count($_FILES['upload_file']['name']);
|
||||
$upload_path = config_item('uploads_dir') . '/files/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
foreach ($_FILES['upload_file']['name'] as $i => $value) {
|
||||
if ($value) {
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = '*';
|
||||
$uploadconfig['max_size'] = 10240;
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
$_FILES['userfile']['name'] = $_FILES['upload_file']['name'][$i];
|
||||
$_FILES['userfile']['type'] = $_FILES['upload_file']['type'][$i];
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['upload_file']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['upload_file']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['upload_file']['size'][$i];
|
||||
if ($this->upload->do_upload()) {
|
||||
$filedata = $this->upload->data();
|
||||
|
||||
$uploadfiledata[$i]['ufi_filename'] = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $filedata);
|
||||
$uploadfiledata[$i]['ufi_originname'] = element('orig_name', $filedata);
|
||||
$uploadfiledata[$i]['ufi_filesize'] = intval(element('file_size', $filedata) * 1024);
|
||||
$uploadfiledata[$i]['ufi_width'] = element('image_width', $filedata) ? element('image_width', $filedata) : 0;
|
||||
$uploadfiledata[$i]['ufi_height'] = element('image_height', $filedata) ? element('image_height', $filedata) : 0;
|
||||
$uploadfiledata[$i]['ufi_type'] = str_replace('.', '', element('file_ext', $filedata));
|
||||
$uploadfiledata[$i]['is_image'] = element('is_image', $filedata) ? element('is_image', $filedata) : 0;
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_FILES) && isset($_FILES['upload_file_update'])
|
||||
&& isset($_FILES['upload_file_update']['name'])
|
||||
&& is_array($_FILES['upload_file_update']['name'])
|
||||
&& $file_error === '') {
|
||||
$filecount = count($_FILES['upload_file_update']['name']);
|
||||
$upload_path = config_item('uploads_dir') . '/files/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
foreach ($_FILES['upload_file_update']['name'] as $i => $value) {
|
||||
if ($value) {
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = '*';
|
||||
$uploadconfig['max_size'] = 10240;
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
$this->upload->initialize($uploadconfig);
|
||||
$_FILES['userfile']['name'] = $_FILES['upload_file_update']['name'][$i];
|
||||
$_FILES['userfile']['type'] = $_FILES['upload_file_update']['type'][$i];
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['upload_file_update']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['upload_file_update']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['upload_file_update']['size'][$i];
|
||||
if ($this->upload->do_upload()) {
|
||||
$filedata = $this->upload->data();
|
||||
|
||||
$olduploadfile = $this->Upload_file_model->get_one($i);
|
||||
if ((int) element('origin_id', $olduploadfile) !== (int) element('app_id', $getdata)) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
@unlink(config_item('uploads_dir') . '/files/' . element('ufi_filename', $oldpostfile));
|
||||
|
||||
$uploadfiledata2[$i]['ufi_id'] = $i;
|
||||
$uploadfiledata2[$i]['ufi_filename'] = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $filedata);
|
||||
$uploadfiledata2[$i]['ufi_originname'] = element('orig_name', $filedata);
|
||||
$uploadfiledata2[$i]['ufi_filesize'] = intval(element('file_size', $filedata) * 1024);
|
||||
$uploadfiledata2[$i]['ufi_width'] = element('image_width', $filedata)
|
||||
? element('image_width', $filedata) : 0;
|
||||
$uploadfiledata2[$i]['ufi_height'] = element('image_height', $filedata)
|
||||
? element('image_height', $filedata) : 0;
|
||||
$uploadfiledata2[$i]['ufi_type'] = str_replace('.', '', element('file_ext', $filedata));
|
||||
$uploadfiledata2[$i]['is_image'] = element('is_image', $filedata)
|
||||
? element('is_image', $filedata) : 0;
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($form_validation === false OR $file_error !== '') {
|
||||
|
||||
if ( ! $pid) {
|
||||
$max_sort = $this->{$this->modelname}->select_max_sort();
|
||||
$getdata['app_sort'] = $max_sort + 1;
|
||||
}
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
if (element('app_id', $getdata)) {
|
||||
$uploadwhere = array(
|
||||
'origin_table' => 'apps',
|
||||
'origin_id' => element('app_id', $getdata),
|
||||
);
|
||||
$view['view']['file'] = $file = $this->Upload_file_model->get('', '', $uploadwhere, '', '', 'ufi_id', 'ASC');
|
||||
if ($file && is_array($file)) {
|
||||
foreach ($file as $key => $value) {
|
||||
$view['view']['file'][$key]['download_link']
|
||||
= site_url('download/downfiles/' . element('ufi_id', $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = array(
|
||||
'app_package' => $this->input->post('app_package', null, ''),
|
||||
'app_name' => $this->input->post('app_name', null, ''),
|
||||
'app_sort' => $this->input->post('app_sort', null, ''),
|
||||
'app_policy' => $this->input->post('app_policy', null, ''),
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
$updatedata['app_updated_at'] = cdate('Y-m-d H:i:s');
|
||||
$this->{$this->modelname}->update($this->input->post($primary_key), $updatedata);
|
||||
$origin_id = $this->input->post($primary_key);
|
||||
$this->session->set_flashdata('message','정상적으로 수정되었습니다');
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('write');
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
|
||||
$updatedata['app_created_at'] = cdate('Y-m-d H:i:s');
|
||||
$updatedata['app_updated_at'] = cdate('Y-m-d H:i:s');
|
||||
|
||||
|
||||
$origin_id = $this->{$this->modelname}->insert($updatedata);
|
||||
$this->session->set_flashdata('message','정상적으로 입력되었습니다');
|
||||
}
|
||||
|
||||
|
||||
$file_updated = false;
|
||||
$file_changed = false;
|
||||
if (is_array($uploadfiledata) && count($uploadfiledata) > 0) {
|
||||
foreach ($uploadfiledata as $pkey => $pval) {
|
||||
if ($pval) {
|
||||
$fileupdate = array(
|
||||
'origin_id' => $origin_id,
|
||||
'origin_table' => 'apps',
|
||||
'user_id' => $this->userlib->item('user_id'),
|
||||
'ufi_originname' => element('ufi_originname', $pval),
|
||||
'ufi_filename' => element('ufi_filename', $pval),
|
||||
'ufi_filesize' => element('ufi_filesize', $pval),
|
||||
'ufi_width' => element('ufi_width', $pval),
|
||||
'ufi_height' => element('ufi_height', $pval),
|
||||
'ufi_type' => element('ufi_type', $pval),
|
||||
'ufi_is_image' => element('is_image', $pval),
|
||||
'ufi_datetime' => cdate('Y-m-d H:i:s'),
|
||||
'ufi_ip' => $this->input->ip_address(),
|
||||
);
|
||||
$file_id = $this->Upload_file_model->insert($fileupdate);
|
||||
$file_updated = true;
|
||||
}
|
||||
}
|
||||
$file_changed = true;
|
||||
}
|
||||
if (is_array($uploadfiledata2) && count($uploadfiledata2) > 0) {
|
||||
foreach ($uploadfiledata2 as $pkey => $pval) {
|
||||
if ($pval) {
|
||||
$fileupdate = array(
|
||||
'user_id' => $this->userlib->item('user_id'),
|
||||
'ufi_originname' => element('ufi_originname', $pval),
|
||||
'ufi_filename' => element('ufi_filename', $pval),
|
||||
'ufi_filesize' => element('ufi_filesize', $pval),
|
||||
'ufi_width' => element('ufi_width', $pval),
|
||||
'ufi_height' => element('ufi_height', $pval),
|
||||
'ufi_type' => element('ufi_type', $pval),
|
||||
'ufi_is_image' => element('is_image', $pval),
|
||||
'ufi_datetime' => cdate('Y-m-d H:i:s'),
|
||||
'ufi_ip' => $this->input->ip_address(),
|
||||
);
|
||||
$this->Upload_file_model->update($pkey, $fileupdate);
|
||||
$file_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->input->post('upload_file_del')) {
|
||||
foreach ($this->input->post('upload_file_del') as $key => $val) {
|
||||
if ($val === '1' && ! isset($uploadfiledata2[$key])) {
|
||||
$olduploadfile = $this->Upload_file_model->get_one($key);
|
||||
if ( ! element('origin_id', $olduploadfile) OR (int) element('origin_id', $olduploadfile) !== (int) $origin_id) {
|
||||
alert('잘못된 접근입니다.');
|
||||
}
|
||||
@unlink(config_item('uploads_dir') . '/files/' . element('ufi_filename', $olduploadfile));
|
||||
$this->Upload_file_model->delete($key);
|
||||
$file_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$redirecturl = admin_url($this->pagedir . '/write/' . $pid);
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write_rank($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
$getdata['app_rank'] = json_decode($getdata['app_rank'], true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_1_title',
|
||||
'label' => '1위 제목',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_1_desc',
|
||||
'label' => '1위 소개내용',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_1_link',
|
||||
'label' => '1위 링크',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_1_image_url',
|
||||
'label' => '1위 이미지 URL',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_2_title',
|
||||
'label' => '2위 제목',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_2_desc',
|
||||
'label' => '2위 소개내용',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_2_link',
|
||||
'label' => '2위 링크',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_2_image_url',
|
||||
'label' => '2위 이미지 URL',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_3_title',
|
||||
'label' => '3위 제목',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_3_desc',
|
||||
'label' => '3위 소개내용',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_3_link',
|
||||
'label' => '3위 링크',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'app_rank_3_image_url',
|
||||
'label' => '3위 이미지 URL',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
$view['view']['data'] = $getdata['app_rank'];
|
||||
$view['view']['data']['app_id'] = $getdata['app_id'];
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write_rank');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = array(
|
||||
'app_rank_1_title' => $this->input->post('app_rank_1_title', null, ''),
|
||||
'app_rank_1_desc' => $this->input->post('app_rank_1_desc', null, ''),
|
||||
'app_rank_1_link' => $this->input->post('app_rank_1_link', null, ''),
|
||||
'app_rank_2_title' => $this->input->post('app_rank_2_title', null, ''),
|
||||
'app_rank_2_desc' => $this->input->post('app_rank_2_desc', null, ''),
|
||||
'app_rank_2_link' => $this->input->post('app_rank_2_link', null, ''),
|
||||
'app_rank_3_title' => $this->input->post('app_rank_3_title', null, ''),
|
||||
'app_rank_3_desc' => $this->input->post('app_rank_3_desc', null, ''),
|
||||
'app_rank_3_link' => $this->input->post('app_rank_3_link', null, ''),
|
||||
'app_rank_1_image_url' => element('app_rank_1_image_url', element('app_rank', $getdata)),
|
||||
'app_rank_2_image_url' => element('app_rank_2_image_url', element('app_rank', $getdata)),
|
||||
'app_rank_3_image_url' => element('app_rank_3_image_url', element('app_rank', $getdata)),
|
||||
);
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
|
||||
|
||||
$this->load->library('upload');
|
||||
$app_rank_1_image_url = '';
|
||||
if (isset($_FILES) && isset($_FILES['app_rank_1_image_url']) && isset($_FILES['app_rank_1_image_url']['name']) && $_FILES['app_rank_1_image_url']['name']) {
|
||||
$upload_path = config_item('uploads_dir') . '/apprank/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
|
||||
$uploadconfig['max_size'] = '2000';
|
||||
$uploadconfig['max_width'] = '1000';
|
||||
$uploadconfig['max_height'] = '1000';
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
|
||||
if ($this->upload->do_upload('app_rank_1_image_url')) {
|
||||
$img = $this->upload->data();
|
||||
$app_rank_1_image_url = element('file_name', $img);
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
}
|
||||
}
|
||||
|
||||
$app_rank_2_image_url = '';
|
||||
if (isset($_FILES) && isset($_FILES['app_rank_2_image_url']) && isset($_FILES['app_rank_2_image_url']['name']) && $_FILES['app_rank_2_image_url']['name']) {
|
||||
$upload_path = config_item('uploads_dir') . '/apprank/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
|
||||
$uploadconfig['max_size'] = '2000';
|
||||
$uploadconfig['max_width'] = '1000';
|
||||
$uploadconfig['max_height'] = '1000';
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
|
||||
if ($this->upload->do_upload('app_rank_2_image_url')) {
|
||||
$img = $this->upload->data();
|
||||
$app_rank_2_image_url = element('file_name', $img);
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
}
|
||||
}
|
||||
|
||||
$app_rank_3_image_url = '';
|
||||
if (isset($_FILES) && isset($_FILES['app_rank_3_image_url']) && isset($_FILES['app_rank_3_image_url']['name']) && $_FILES['app_rank_3_image_url']['name']) {
|
||||
$upload_path = config_item('uploads_dir') . '/apprank/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
|
||||
$uploadconfig['max_size'] = '2000';
|
||||
$uploadconfig['max_width'] = '1000';
|
||||
$uploadconfig['max_height'] = '1000';
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
|
||||
if ($this->upload->do_upload('app_rank_3_image_url')) {
|
||||
$img = $this->upload->data();
|
||||
$app_rank_3_image_url = element('file_name', $img);
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
}
|
||||
}
|
||||
|
||||
if ($app_rank_1_image_url) {
|
||||
$updatedata['app_rank_1_image_url'] = $app_rank_1_image_url;
|
||||
}
|
||||
if ($app_rank_2_image_url) {
|
||||
$updatedata['app_rank_2_image_url'] = $app_rank_2_image_url;
|
||||
}
|
||||
if ($app_rank_3_image_url) {
|
||||
$updatedata['app_rank_3_image_url'] = $app_rank_3_image_url;
|
||||
}
|
||||
|
||||
$updata = json_encode($updatedata,JSON_UNESCAPED_UNICODE);
|
||||
|
||||
|
||||
|
||||
$this->{$this->modelname}->update($pid, array('app_rank' => $updata));
|
||||
$this->session->set_flashdata('message','정상적으로 수정되었습니다');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$redirecturl = admin_url($this->pagedir . '/write_rank/' . $pid);
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata('message','정상적으로 삭제되었습니다');
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
260
application/controllers/admin/config/Configlibs.php
Normal file
260
application/controllers/admin/config/Configlibs.php
Normal file
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Configlibs class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>환경설정>기본환경설정 controller 입니다.
|
||||
*/
|
||||
class Configlibs extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'config/configlibs';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Config');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Config_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'dhtml_editor');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본환경설정>기본정보 페이지입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'site_title',
|
||||
'label' => '홈페이지 제목',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'admin_logo',
|
||||
'label' => '관리자페이지 로고',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'footer_script',
|
||||
'label' => '하단스크립트',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'webmaster_name',
|
||||
'label' => '웹마스터 이름',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'webmaster_email',
|
||||
'label' => '웹마스터 이메일주소',
|
||||
'rules' => 'trim|required|valid_email',
|
||||
),
|
||||
array(
|
||||
'field' => 'spam_word',
|
||||
'label' => '단어 필터링',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'white_iframe',
|
||||
'label' => '허용하는 Iframe 주소',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_recaptcha',
|
||||
'label' => '구글 캡챠 사용 여부',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'recaptcha_sitekey',
|
||||
'label' => '구글 reCaptcha Sitekey',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'recaptcha_secret',
|
||||
'label' => '구글 reCaptcha Secret',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$array = array(
|
||||
'site_title', 'admin_logo', 'footer_script', 'webmaster_name', 'webmaster_email',
|
||||
'spam_word', 'white_iframe',
|
||||
'use_recaptcha', 'recaptcha_sitekey', 'recaptcha_secret'
|
||||
);
|
||||
foreach ($array as $value) {
|
||||
$savedata[$value] = $this->input->post($value, null, '');
|
||||
}
|
||||
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '기본정보 설정이 저장되었습니다';
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본환경설정>접근기능 페이지입니다
|
||||
*/
|
||||
public function access()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'admin_ip_whitelist',
|
||||
'label' => '관리자페이지 접근가능 IP',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'site_ip_blacklist',
|
||||
'label' => '사이트 접근 불가 IP',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'site_ip_whitelist',
|
||||
'label' => '사이트 접근 가능 IP',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'site_blacklist_title',
|
||||
'label' => '사이트 차단시 안내문 제목',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'site_blacklist_content',
|
||||
'label' => '사이트 차단시 안내문 내용',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$array = array(
|
||||
'admin_ip_whitelist', 'site_ip_blacklist', 'site_ip_whitelist',
|
||||
'site_blacklist_title', 'site_blacklist_content',
|
||||
);
|
||||
foreach ($array as $value) {
|
||||
$savedata[$value] = $this->input->post($value, null, '');
|
||||
}
|
||||
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '접근기능 설정이 저장되었습니다';
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'access');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
}
|
||||
120
application/controllers/admin/config/Dbupgrade.php
Normal file
120
application/controllers/admin/config/Dbupgrade.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Dbupgrade class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>환경설정>DB 업그레이드 controller 입니다.
|
||||
*/
|
||||
class Dbupgrade extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'config/dbupgrade';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array();
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = '';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 디비 업그레이드 페이지입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 마이그레이션 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('migration');
|
||||
$this->config->load('migration');
|
||||
$row = $this->db->get('migrations')->row();
|
||||
$view['view']['current_version'] = $row ? $row->version : 0;
|
||||
$view['view']['latest_version'] = $latest_version = config_item('migration_version');
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'execute',
|
||||
'label' => '실행',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
if ($this->migration->version($latest_version) === false) {
|
||||
$view['view']['alert_message'] = $this->migration->error_string();
|
||||
} else {
|
||||
$row = $this->db->get('migrations')->row();
|
||||
$view['view']['current_version'] = $row ? $row->version : 0;
|
||||
$view['view']['latest_version'] = config_item('migration_version');
|
||||
$view['view']['alert_message'] = '최신버전으로 업그레이드가 완료되었습니다';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
}
|
||||
764
application/controllers/admin/config/Userconfig.php
Normal file
764
application/controllers/admin/config/Userconfig.php
Normal file
@@ -0,0 +1,764 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Userconfig class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>환경설정>회원가입설정 controller 입니다.
|
||||
*/
|
||||
class Userconfig extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'config/userconfig';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Config');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Config_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입설정>기본정보 페이지입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_login_account',
|
||||
'label' => '로그인시 사용할 계정',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_register_block',
|
||||
'label' => '회원가입차단',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_register_email_auth',
|
||||
'label' => '회원가입시 메일인증사용',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'password_length',
|
||||
'label' => '비밀번호 길이',
|
||||
'rules' => 'trim|required|numeric|is_natural_no_zero',
|
||||
),
|
||||
array(
|
||||
'field' => 'password_uppercase_length',
|
||||
'label' => '비밀번호 대문자 포함 개수',
|
||||
'rules' => 'trim|required|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'password_numbers_length',
|
||||
'label' => '비밀번호 수자 포함 개수',
|
||||
'rules' => 'trim|required|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'password_specialchars_length',
|
||||
'label' => '비밀번호 특수문자 포함 개수',
|
||||
'rules' => 'trim|required|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_user_photo',
|
||||
'label' => '회원프로필사진',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_photo_width',
|
||||
'label' => '회원프로필사진가로길이',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_photo_height',
|
||||
'label' => '회원프로필사진세로길이',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_user_icon',
|
||||
'label' => '회원아이콘',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_icon_width',
|
||||
'label' => '회원아이콘가로길이',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_icon_height',
|
||||
'label' => '회원아이콘세로길이',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'denied_username_list',
|
||||
'label' => '금지 회원명',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'denied_email_list',
|
||||
'label' => '금지 이메일',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$array = array('use_login_account', 'use_register_block', 'use_register_email_auth',
|
||||
'password_length', 'password_uppercase_length', 'password_numbers_length',
|
||||
'password_specialchars_length', 'use_user_photo', 'user_photo_width',
|
||||
'user_photo_height', 'use_user_icon', 'user_icon_width', 'user_icon_height',
|
||||
'denied_username_list', 'denied_email_list');
|
||||
foreach ($array as $value) {
|
||||
$savedata[$value] = $this->input->post($value, null, '');
|
||||
}
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '회원가입 기본정보설정이 저장되었습니다';
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입설정>가입폼관리 페이지입니다
|
||||
*/
|
||||
public function registerform()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 's',
|
||||
'label' => '회원가입폼',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
$default_form = array(
|
||||
'user_email' => array(
|
||||
'name' => '이메일주소', 'field_type' => 'email', 'use' => true, 'disable_use' => true, 'open' => false, 'disable_open' => true, 'required' => true, 'disable_required' => true
|
||||
),
|
||||
'user_password' => array(
|
||||
'name' => '비밀번호', 'field_type' => 'password', 'use' => true, 'disable_use' => true, 'open' => false, 'disable_open' => true, 'required' => true, 'disable_required' => true
|
||||
),
|
||||
'user_username' => array(
|
||||
'name' => '이름', 'field_type' => 'text', 'use' => true, 'disable_use' => false, 'open' => false, 'disable_open' => false, 'required' => false, 'disable_required' => false
|
||||
),
|
||||
'user_homepage' => array(
|
||||
'name' => '홈페이지', 'field_type' => 'url', 'use' => true, 'disable_use' => false, 'open' => false, 'disable_open' => false, 'required' => false, 'disable_required' => false
|
||||
),
|
||||
'user_phone' => array(
|
||||
'name' => '전화번호', 'field_type' => 'phone', 'use' => true, 'disable_use' => false, 'open' => false, 'disable_open' => false, 'required' => false, 'disable_required' => false
|
||||
),
|
||||
'user_birthday' => array(
|
||||
'name' => '생년월일', 'field_type' => 'date', 'use' => true, 'disable_use' => false, 'open' => false, 'disable_open' => false, 'required' => false, 'disable_required' => false
|
||||
),
|
||||
'user_sex' => array(
|
||||
'name' => '성별', 'field_type' => 'radio', 'use' => true, 'disable_use' => false, 'open' => false, 'disable_open' => false, 'required' => false, 'disable_required' => false
|
||||
),
|
||||
'user_address' => array(
|
||||
'name' => '주소', 'field_type' => 'address', 'use' => true, 'disable_use' => false, 'open' => false, 'disable_open' => false, 'required' => false, 'disable_required' => false
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = $this->input->post();
|
||||
|
||||
$array_count_values = array_count_values($updatedata['field_name']);
|
||||
$fail = false;
|
||||
if ($fail === false) {
|
||||
foreach ($array_count_values as $akey => $aval) {
|
||||
if ($aval > 1) {
|
||||
$view['view']['warning_message'] = $akey . ' 값이 ' . $aval . ' 회 중복 입력되었습니다. ID 값이 중복되지 않게 입력해주세요';
|
||||
$fail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($fail === false) {
|
||||
foreach (element('field_name', $updatedata) as $fkey => $fval) {
|
||||
if (empty($fval)) {
|
||||
$view['view']['warning_message'] = '비어있는 ID 값이 있습니다. ID 값을 빠뜨리지 말고 입력해주세요';
|
||||
$fail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($fail === false) {
|
||||
foreach (element('display_name', $updatedata) as $fkey => $fval) {
|
||||
if (empty($fval)) {
|
||||
$view['view']['warning_message'] = '비어있는 입력항목제목이 있습니다. 입력항목제목 값을 빠뜨리지 말고 입력해주세요';
|
||||
$fail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($fail === false) {
|
||||
$order = 0;
|
||||
$update = array();
|
||||
$extra_vars_field = array();
|
||||
|
||||
foreach (element('key', $updatedata) as $key => $value) {
|
||||
if ($value) {
|
||||
if (isset($updatedata['basic'][$value]) && $updatedata['basic'][$value]) {
|
||||
$update[$value]['field_name'] = $value;
|
||||
$update[$value]['func'] = 'basic';
|
||||
$update[$value]['display_name'] = element('name', element($value, $default_form));
|
||||
$update[$value]['field_type'] = element('field_type', element($value, $default_form));
|
||||
$update[$value]['use'] = element('disable_use', element($value, $default_form))
|
||||
? (element('use', element($value, $default_form)) ? '1' : '')
|
||||
: element($value, element('use', $updatedata));
|
||||
$update[$value]['open'] = element('disable_open', element($value, $default_form))
|
||||
? (element('open', element($value, $default_form)) ? '1' : '')
|
||||
: element($value, element('open', $updatedata));
|
||||
$update[$value]['required'] = element('disable_required', element($value, $default_form))
|
||||
? (element('required', element($value, $default_form)) ? '1' : '')
|
||||
: element($value, element('required', $updatedata));
|
||||
|
||||
} else {
|
||||
$update[$value] = array(
|
||||
'field_name' => element($order, element('field_name', $updatedata)),
|
||||
'func' => 'added',
|
||||
'display_name' => element($order, element('display_name', $updatedata)),
|
||||
'field_type' => element($value, element('field_type', $updatedata)),
|
||||
'use' => element($value, element('use', $updatedata)),
|
||||
'open' => element($value, element('open', $updatedata)),
|
||||
'required' => element($value, element('required', $updatedata)),
|
||||
'options' => element($value, element('options', $updatedata)),
|
||||
);
|
||||
$extra_vars_field[] = element($order, element('field_name', $updatedata));
|
||||
}
|
||||
} else {
|
||||
$update[$updatedata['field_name'][$order]] = array(
|
||||
'field_name' => element($order, element('field_name', $updatedata)),
|
||||
'func' => 'added',
|
||||
'display_name' => element($order, element('display_name', $updatedata)),
|
||||
'use' => element($key, element('use', $updatedata)),
|
||||
'field_type' => element($key, element('field_type', $updatedata)),
|
||||
'open' => element($key, element('open', $updatedata)),
|
||||
'required' => element($key, element('required', $updatedata)),
|
||||
'options' => element($key, element('options', $updatedata)),
|
||||
);
|
||||
$extra_vars_field[] = element($order, element('field_name', $updatedata));
|
||||
}
|
||||
$order++;
|
||||
}
|
||||
|
||||
if ($default_form && is_array($default_form)) {
|
||||
foreach ($default_form as $key => $value) {
|
||||
if (isset($update[$key]) && $update[$key]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$update[$key]['field_name'] = $key;
|
||||
$update[$key]['func'] = 'basic';
|
||||
$update[$key]['display_name'] = element('name', element($key, $default_form));
|
||||
$update[$key]['field_type'] = element('field_type', element($key, $default_form));
|
||||
$update[$key]['use'] = element('disable_use', element($key, $default_form))
|
||||
? (element('use', element($key, $default_form)) ? '1' : '')
|
||||
: element($key, element('use', $updatedata));
|
||||
$update[$key]['open'] = element('disable_open', element($key, $default_form))
|
||||
? (element('open', element($key, $default_form)) ? '1' : '')
|
||||
: element($key, element('open', $updatedata));
|
||||
$update[$key]['required'] = element('disable_required', element($key, $default_form))
|
||||
? (element('required', element($key, $default_form)) ? '1' : '')
|
||||
: element($key, element('required', $updatedata));
|
||||
}
|
||||
}
|
||||
|
||||
$savedata = array(
|
||||
'registerform' => json_encode($update),
|
||||
);
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '정상적으로 저장되었습니다';
|
||||
}
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
|
||||
if ( ! element('registerform', $getdata)) {
|
||||
foreach ($default_form as $key => $value) {
|
||||
$initdata[$key]['field_name'] = $key;
|
||||
$initdata[$key]['func'] = 'basic';
|
||||
$initdata[$key]['display_name'] = element('name', element($key, $default_form));
|
||||
$initdata[$key]['field_type'] = element('field_type', element($key, $default_form));
|
||||
$initdata[$key]['use'] = element('disable_use', element($key, $default_form))
|
||||
? (element('use', element($key, $default_form)) ? '1' : '') : '';
|
||||
$initdata[$key]['open'] = element('disable_open', element($key, $default_form))
|
||||
? (element('open', element($key, $default_form)) ? '1' : '') : '';
|
||||
$initdata[$key]['required'] = element('disable_required', element($key, $default_form))
|
||||
? (element('required', element($key, $default_form)) ? '1' : '') : '';
|
||||
}
|
||||
$getdata['registerform'] = json_encode($initdata);
|
||||
}
|
||||
|
||||
$getdata['result'] = json_decode($getdata['registerform'], true);
|
||||
$getdata['default_form'] = $default_form;
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'registerform');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입설정>로그인 페이지입니다
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'change_password_date',
|
||||
'label' => '비밀번호 갱신주기',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'max_login_try_count',
|
||||
'label' => '로그인시도 회수제한',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'max_login_try_limit_second',
|
||||
'label' => '로그인시도제한시간',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'url_after_login',
|
||||
'label' => '로그인후이동할주소',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'url_after_logout',
|
||||
'label' => '로그아웃후이동할주소',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$array = array('change_password_date', 'max_login_try_count',
|
||||
'max_login_try_limit_second', 'url_after_login', 'url_after_logout');
|
||||
foreach ($array as $value) {
|
||||
$savedata[$value] = $this->input->post($value, null, '');
|
||||
}
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '로그인 설정이 저장되었습니다';
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'login');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입설정>알림 페이지입니다
|
||||
*/
|
||||
public function alarm()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_register_admin',
|
||||
'label' => '회원가입시최고관리자에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_register_user',
|
||||
'label' => '회원가입시가입한회원에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_register_alluser',
|
||||
'label' => '회원가입시가입한회원에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_changepw_admin',
|
||||
'label' => '패스워드변경시최고관리자에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_changepw_user',
|
||||
'label' => '패스워드변경시가입한회원에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_changepw_alluser',
|
||||
'label' => '패스워드변경시가입한회원에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_userleave_admin',
|
||||
'label' => '패스워드변경시최고관리자에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_userleave_user',
|
||||
'label' => '패스워드변경시가입한회원에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'send_email_userleave_alluser',
|
||||
'label' => '패스워드변경시가입한회원에게메일발송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$array = array(
|
||||
'send_email_register_admin', 'send_email_register_user', 'send_email_register_alluser',
|
||||
'send_email_changepw_admin', 'send_email_changepw_user', 'send_email_changepw_alluser',
|
||||
'send_email_userleave_admin', 'send_email_userleave_user', 'send_email_userleave_alluser',
|
||||
);
|
||||
foreach ($array as $value) {
|
||||
$savedata[$value] = $this->input->post($value, null, '');
|
||||
}
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '알림 설정이 저장되었습니다';
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'alarm');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입설정>소셜로그인 페이지입니다
|
||||
*/
|
||||
public function sociallogin()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'is_submit',
|
||||
'label' => '전송',
|
||||
'rules' => 'trim|numeric',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_sociallogin',
|
||||
'label' => '소셜로그인 사용',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_sociallogin_facebook',
|
||||
'label' => '페이스북 사용',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'facebook_app_id',
|
||||
'label' => '페이스북 APP ID',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'facebook_secret',
|
||||
'label' => '페이스북 Secret',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_sociallogin_twitter',
|
||||
'label' => '트위터 사용',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'twitter_consumer_key',
|
||||
'label' => '트위터 Consumer Key',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'twitter_consumer_secret',
|
||||
'label' => '트위터 Consumer Secret',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_sociallogin_google',
|
||||
'label' => '구글 사용',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'google_client_id',
|
||||
'label' => '구글 Client ID',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'google_client_secret',
|
||||
'label' => '구글 Client Secret',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_sociallogin_naver',
|
||||
'label' => '네이버 사용',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'naver_client_id',
|
||||
'label' => '네이버 Client ID',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'naver_client_secret',
|
||||
'label' => '네이버 Client Secret',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'use_sociallogin_kakao',
|
||||
'label' => '카카오 사용',
|
||||
'rules' => 'trim|numeric|is_natural',
|
||||
),
|
||||
array(
|
||||
'field' => 'kakao_client_id',
|
||||
'label' => '카카오 Client ID',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$array = array(
|
||||
'use_sociallogin', 'use_sociallogin_facebook', 'facebook_app_id',
|
||||
'facebook_secret', 'use_sociallogin_twitter', 'twitter_consumer_key', 'twitter_consumer_secret',
|
||||
'use_sociallogin_google', 'google_client_id', 'google_client_secret', 'use_sociallogin_naver',
|
||||
'naver_client_id', 'naver_client_secret', 'use_sociallogin_kakao', 'kakao_client_id'
|
||||
);
|
||||
foreach ($array as $value) {
|
||||
$savedata[$value] = $this->input->post($value, null, '');
|
||||
}
|
||||
$this->Config_model->save($savedata);
|
||||
$view['view']['alert_message'] = '소셜로그인 설정이 저장되었습니다';
|
||||
}
|
||||
|
||||
$getdata = $this->Config_model->get_all_meta();
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'sociallogin');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
}
|
||||
170
application/controllers/admin/contents/Bookmark.php
Normal file
170
application/controllers/admin/contents/Bookmark.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Bookmark class
|
||||
*/
|
||||
|
||||
class Bookmark extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/bookmark';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Contents_bookmark', 'Apps', 'Contents_category');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Contents_bookmark_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('bookmark_id', 'target_user_id', 'contents_bookmark.user_id', 'contents', 'contents_bookmark.con_id'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('bookmark_id', 'contents_bookmark.con_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('bookmark_id'); // 정렬이 가능한 필드
|
||||
$where = array();
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['contents_bookmark.app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
if (element('cat1_id', $val)) {
|
||||
$result['list'][$key]['category1'] = $this->Contents_category_model->get_one(element('cat1_id', $val));
|
||||
}
|
||||
if (element('cat2_id', $val)) {
|
||||
$result['list'][$key]['category2'] = $this->Contents_category_model->get_one(element('cat2_id', $val));
|
||||
}
|
||||
/*
|
||||
if (element('cat3_id', $val)) {
|
||||
$result['list'][$key]['category3'] = $this->Contents_category_model->get_one(element('cat3_id', $val));
|
||||
}
|
||||
if (element('cat4_id', $val)) {
|
||||
$result['list'][$key]['category4'] = $this->Contents_category_model->get_one(element('cat4_id', $val));
|
||||
}
|
||||
*/
|
||||
$result['list'][$key]['display_name'] = display_username(
|
||||
element('user_username', $val)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('bookmark_id' => '고유번호');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$getdata = $this->{$this->modelname}->get_one($val);
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
172
application/controllers/admin/contents/Comment.php
Normal file
172
application/controllers/admin/contents/Comment.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Comment class
|
||||
*/
|
||||
|
||||
class Comment extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/comment';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Contents', 'Contents_comment', 'Upload_file', 'Apps', 'Contents_category');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Contents_comment_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'dhtml_editor');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : 'con_sort';
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('app_id','com_id', 'contents_comment.con_id', 'com_content', 'contents_comment.user_id', 'contents.user_id', 'com_created_at'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('app_id','com_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('con_id', 'com_id'); // 정렬이 가능한 필드
|
||||
$where = array('contents.is_del' => '0');
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['contents.app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
if ($this->input->get('cat_id')) {
|
||||
$where['contents.cat_id'] = $this->input->get('cat_id');
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
if (element('cat1_id', $val)) {
|
||||
$result['list'][$key]['category1'] = $this->Contents_category_model->get_one(element('cat1_id', $val));
|
||||
}
|
||||
if (element('cat2_id', $val)) {
|
||||
$result['list'][$key]['category2'] = $this->Contents_category_model->get_one(element('cat2_id', $val));
|
||||
}
|
||||
/*
|
||||
if (element('cat3_id', $val)) {
|
||||
$result['list'][$key]['category3'] = $this->Contents_category_model->get_one(element('cat3_id', $val));
|
||||
}
|
||||
if (element('cat4_id', $val)) {
|
||||
$result['list'][$key]['category4'] = $this->Contents_category_model->get_one(element('cat4_id', $val));
|
||||
}
|
||||
*/
|
||||
$result['list'][$key]['display_name'] = display_username(
|
||||
element('user_username', $val)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('com_content' => '댓글내용');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata('message','정상적으로 삭제되었습니다');
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
1017
application/controllers/admin/contents/Content.php
Normal file
1017
application/controllers/admin/contents/Content.php
Normal file
File diff suppressed because it is too large
Load Diff
1163
application/controllers/admin/contents/Crawl.php
Normal file
1163
application/controllers/admin/contents/Crawl.php
Normal file
File diff suppressed because it is too large
Load Diff
167
application/controllers/admin/contents/Crawlhistory.php
Normal file
167
application/controllers/admin/contents/Crawlhistory.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Crawlhistory class
|
||||
*/
|
||||
|
||||
class Crawlhistory extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/crawlhistory';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Crawl_list', 'Upload_file', 'Apps', 'Contents_category', 'Contents', 'Contents_tag', 'Crawl_history');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Crawl_history_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('app_id', 'crawl_title'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('app_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('crawl_id'); // 정렬이 가능한 필드
|
||||
$where = array();
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['crawl_history.app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
if ($this->input->get('cat_id')) {
|
||||
$where['crawl_history.cat_id'] = $this->input->get('cat_id');
|
||||
}
|
||||
if ($this->input->get('site_key')) {
|
||||
$where['crawl_history.site_key'] = $this->input->get('site_key');
|
||||
}
|
||||
if ($this->input->get('crawl_category_name')) {
|
||||
$where['crawl_list.crawl_category_name'] = $this->input->get('crawl_category_name');
|
||||
}
|
||||
if ($this->input->get('start_date')) {
|
||||
$where['crawl_history.history_at >='] = $this->input->get('start_date');
|
||||
}
|
||||
if ($this->input->get('end_date')) {
|
||||
$where['crawl_history.history_at <='] = $this->input->get('end_date');
|
||||
}
|
||||
$result = $this->Crawl_history_model->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
if (element('cat_id', $val)) {
|
||||
$result['list'][$key]['category'] = $this->Contents_category_model->get_one(element('cat_id', $val));
|
||||
$result['list'][$key]['origin_link'] = '';
|
||||
if (element('site_type', $val) == '1') {
|
||||
if (element('crawl_category', $val)) {
|
||||
$result['list'][$key]['origin_link'] = 'http://m.blog.naver.com/PostList.nhn?blogId=' . element('site_key', $val) . '&categoryNo=' . element('crawl_category', $val);
|
||||
} else {
|
||||
$result['list'][$key]['origin_link'] = 'http://m.blog.naver.com/' . element('site_key', $val);
|
||||
}
|
||||
}
|
||||
if (element('site_type', $val) == '2') {
|
||||
$result['list'][$key]['origin_link'] = 'ttp://m.post.naver.com/my.nhn?memberNo=' . element('site_key', $val);
|
||||
}
|
||||
if (element('site_type', $val) == '3') {
|
||||
if (element('crawl_category', $val)) {
|
||||
$result['list'][$key]['origin_link'] = 'https://www.vingle.net/collections/' . element('crawl_category', $val);
|
||||
} else {
|
||||
$result['list'][$key]['origin_link'] = 'https://www.vingle.net/' . element('site_key', $val);
|
||||
}
|
||||
}
|
||||
if (element('site_type', $val) == '4') {
|
||||
$result['list'][$key]['origin_link'] = 'https://story.kakao.com/ch/' . element('site_key', $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
$view['view']['crawl_site'] = $this->Crawl_list_model->get_by_site();
|
||||
$view['view']['crawl_category'] = $this->Crawl_list_model->get_by_category();
|
||||
if ($this->input->get('app_id')) {
|
||||
$view['view']['app_category'] = $this->Contents_category_model->cat_list($this->input->get('app_id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('crawl_title' => '제목');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
}
|
||||
170
application/controllers/admin/contents/Like.php
Normal file
170
application/controllers/admin/contents/Like.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Like class
|
||||
*/
|
||||
|
||||
class Like extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/like';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Contents_like', 'Apps', 'Contents_category');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Contents_like_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('like_id', 'target_user_id', 'contents_like.user_id', 'contents', 'contents_like.con_id'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('like_id', 'contents_like.con_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('like_id'); // 정렬이 가능한 필드
|
||||
$where = array();
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['contents_like.app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
if (element('cat1_id', $val)) {
|
||||
$result['list'][$key]['category1'] = $this->Contents_category_model->get_one(element('cat1_id', $val));
|
||||
}
|
||||
if (element('cat2_id', $val)) {
|
||||
$result['list'][$key]['category2'] = $this->Contents_category_model->get_one(element('cat2_id', $val));
|
||||
}
|
||||
/*
|
||||
if (element('cat3_id', $val)) {
|
||||
$result['list'][$key]['category3'] = $this->Contents_category_model->get_one(element('cat3_id', $val));
|
||||
}
|
||||
if (element('cat4_id', $val)) {
|
||||
$result['list'][$key]['category4'] = $this->Contents_category_model->get_one(element('cat4_id', $val));
|
||||
}
|
||||
*/
|
||||
$result['list'][$key]['display_name'] = display_username(
|
||||
element('user_username', $val)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('like_id' => '고유번호');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$getdata = $this->{$this->modelname}->get_one($val);
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
498
application/controllers/admin/contents/Notice.php
Normal file
498
application/controllers/admin/contents/Notice.php
Normal file
@@ -0,0 +1,498 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Notice class
|
||||
*/
|
||||
|
||||
class Notice extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/notice';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Notice', 'Upload_file', 'Apps');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Notice_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'dhtml_editor');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('app_id','notice_title','notice_content'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('app_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('notice_id'); // 정렬이 가능한 필드
|
||||
$where = array();
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['notice.app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('notice_title' => '제목','notice_content' => '내용');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
} else if ($this->input->get('app_id')) {
|
||||
$getdata['app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$view['view']['upload_file_count'] = $upload_file_count = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array('field' => 'app_id', 'label' => '어플이름', 'rules' => 'trim|required'),
|
||||
array('field' => 'notice_title', 'label' => '제목', 'rules' => 'trim|required'),
|
||||
array('field' => 'notice_content', 'label' => '내용', 'rules' => 'trim|required'),
|
||||
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
$form_validation = $this->form_validation->run();
|
||||
$file_error = '';
|
||||
|
||||
|
||||
$uploadfiledata = '';
|
||||
$uploadfiledata2 = '';
|
||||
if ($upload_file_count > 0 && $form_validation) {
|
||||
$this->load->library('upload');
|
||||
if (isset($_FILES) && isset($_FILES['upload_file']) && isset($_FILES['upload_file']['name']) && is_array($_FILES['upload_file']['name'])) {
|
||||
$filecount = count($_FILES['upload_file']['name']);
|
||||
$upload_path = config_item('uploads_dir') . '/files/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
foreach ($_FILES['upload_file']['name'] as $i => $value) {
|
||||
if ($value) {
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = '*';
|
||||
$uploadconfig['max_size'] = 10240;
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
$_FILES['userfile']['name'] = $_FILES['upload_file']['name'][$i];
|
||||
$_FILES['userfile']['type'] = $_FILES['upload_file']['type'][$i];
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['upload_file']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['upload_file']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['upload_file']['size'][$i];
|
||||
if ($this->upload->do_upload()) {
|
||||
$filedata = $this->upload->data();
|
||||
|
||||
$uploadfiledata[$i]['ufi_filename'] = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $filedata);
|
||||
$uploadfiledata[$i]['ufi_originname'] = element('orig_name', $filedata);
|
||||
$uploadfiledata[$i]['ufi_filesize'] = intval(element('file_size', $filedata) * 1024);
|
||||
$uploadfiledata[$i]['ufi_width'] = element('image_width', $filedata) ? element('image_width', $filedata) : 0;
|
||||
$uploadfiledata[$i]['ufi_height'] = element('image_height', $filedata) ? element('image_height', $filedata) : 0;
|
||||
$uploadfiledata[$i]['ufi_type'] = str_replace('.', '', element('file_ext', $filedata));
|
||||
$uploadfiledata[$i]['is_image'] = element('is_image', $filedata) ? element('is_image', $filedata) : 0;
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_FILES) && isset($_FILES['upload_file_update'])
|
||||
&& isset($_FILES['upload_file_update']['name'])
|
||||
&& is_array($_FILES['upload_file_update']['name'])
|
||||
&& $file_error === '') {
|
||||
$filecount = count($_FILES['upload_file_update']['name']);
|
||||
$upload_path = config_item('uploads_dir') . '/files/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
foreach ($_FILES['upload_file_update']['name'] as $i => $value) {
|
||||
if ($value) {
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = '*';
|
||||
$uploadconfig['max_size'] = 10240;
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
$this->upload->initialize($uploadconfig);
|
||||
$_FILES['userfile']['name'] = $_FILES['upload_file_update']['name'][$i];
|
||||
$_FILES['userfile']['type'] = $_FILES['upload_file_update']['type'][$i];
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['upload_file_update']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['upload_file_update']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['upload_file_update']['size'][$i];
|
||||
if ($this->upload->do_upload()) {
|
||||
$filedata = $this->upload->data();
|
||||
|
||||
$olduploadfile = $this->Upload_file_model->get_one($i);
|
||||
if ((int) element('origin_id', $olduploadfile) !== (int) element('notice_id', $getdata)) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
@unlink(config_item('uploads_dir') . '/files/' . element('ufi_filename', $oldpostfile));
|
||||
|
||||
$uploadfiledata2[$i]['ufi_id'] = $i;
|
||||
$uploadfiledata2[$i]['ufi_filename'] = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $filedata);
|
||||
$uploadfiledata2[$i]['ufi_originname'] = element('orig_name', $filedata);
|
||||
$uploadfiledata2[$i]['ufi_filesize'] = intval(element('file_size', $filedata) * 1024);
|
||||
$uploadfiledata2[$i]['ufi_width'] = element('image_width', $filedata)
|
||||
? element('image_width', $filedata) : 0;
|
||||
$uploadfiledata2[$i]['ufi_height'] = element('image_height', $filedata)
|
||||
? element('image_height', $filedata) : 0;
|
||||
$uploadfiledata2[$i]['ufi_type'] = str_replace('.', '', element('file_ext', $filedata));
|
||||
$uploadfiledata2[$i]['is_image'] = element('is_image', $filedata)
|
||||
? element('is_image', $filedata) : 0;
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($form_validation === false OR $file_error !== '') {
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
if (element('notice_id', $getdata)) {
|
||||
$uploadwhere = array(
|
||||
'origin_table' => 'notice',
|
||||
'origin_id' => element('notice_id', $getdata),
|
||||
);
|
||||
$view['view']['file'] = $file = $this->Upload_file_model->get('', '', $uploadwhere, '', '', 'ufi_id', 'ASC');
|
||||
if ($file && is_array($file)) {
|
||||
foreach ($file as $key => $value) {
|
||||
$view['view']['file'][$key]['download_link']
|
||||
= site_url('download/downfiles/' . element('ufi_id', $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = array(
|
||||
'app_id' => $this->input->post('app_id', null, ''),
|
||||
'notice_title' => $this->input->post('notice_title', null, ''),
|
||||
'notice_content' => $this->input->post('notice_content', null, ''),
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
$updatedata['updated_at'] = cdate('Y-m-d H:i:s');
|
||||
$this->{$this->modelname}->update($this->input->post($primary_key), $updatedata);
|
||||
$origin_id = $this->input->post($primary_key);
|
||||
$this->session->set_flashdata('message','정상적으로 수정되었습니다');
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('write');
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
|
||||
$updatedata['created_at'] = cdate('Y-m-d H:i:s');
|
||||
$updatedata['updated_at'] = cdate('Y-m-d H:i:s');
|
||||
$updatedata['user_id'] = $this->userlib->item('user_id');
|
||||
$updatedata['user_name'] = $this->userlib->item('user_username');
|
||||
$origin_id = $this->{$this->modelname}->insert($updatedata);
|
||||
$this->session->set_flashdata('message','정상적으로 입력되었습니다');
|
||||
}
|
||||
|
||||
|
||||
$file_updated = false;
|
||||
$file_changed = false;
|
||||
if (is_array($uploadfiledata) && count($uploadfiledata) > 0) {
|
||||
foreach ($uploadfiledata as $pkey => $pval) {
|
||||
if ($pval) {
|
||||
$fileupdate = array(
|
||||
'origin_id' => $origin_id,
|
||||
'origin_table' => 'notice',
|
||||
'user_id' => $this->userlib->item('user_id'),
|
||||
'ufi_originname' => element('ufi_originname', $pval),
|
||||
'ufi_filename' => element('ufi_filename', $pval),
|
||||
'ufi_filesize' => element('ufi_filesize', $pval),
|
||||
'ufi_width' => element('ufi_width', $pval),
|
||||
'ufi_height' => element('ufi_height', $pval),
|
||||
'ufi_type' => element('ufi_type', $pval),
|
||||
'ufi_is_image' => element('is_image', $pval),
|
||||
'ufi_datetime' => cdate('Y-m-d H:i:s'),
|
||||
'ufi_ip' => $this->input->ip_address(),
|
||||
);
|
||||
$file_id = $this->Upload_file_model->insert($fileupdate);
|
||||
$file_updated = true;
|
||||
}
|
||||
}
|
||||
$file_changed = true;
|
||||
}
|
||||
if (is_array($uploadfiledata2) && count($uploadfiledata2) > 0) {
|
||||
foreach ($uploadfiledata2 as $pkey => $pval) {
|
||||
if ($pval) {
|
||||
$fileupdate = array(
|
||||
'user_id' => $this->userlib->item('user_id'),
|
||||
'ufi_originname' => element('ufi_originname', $pval),
|
||||
'ufi_filename' => element('ufi_filename', $pval),
|
||||
'ufi_filesize' => element('ufi_filesize', $pval),
|
||||
'ufi_width' => element('ufi_width', $pval),
|
||||
'ufi_height' => element('ufi_height', $pval),
|
||||
'ufi_type' => element('ufi_type', $pval),
|
||||
'ufi_is_image' => element('is_image', $pval),
|
||||
'ufi_datetime' => cdate('Y-m-d H:i:s'),
|
||||
'ufi_ip' => $this->input->ip_address(),
|
||||
);
|
||||
$this->Upload_file_model->update($pkey, $fileupdate);
|
||||
$file_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->input->post('upload_file_del')) {
|
||||
foreach ($this->input->post('upload_file_del') as $key => $val) {
|
||||
if ($val === '1' && ! isset($uploadfiledata2[$key])) {
|
||||
$olduploadfile = $this->Upload_file_model->get_one($key);
|
||||
if ( ! element('origin_id', $olduploadfile) OR (int) element('origin_id', $olduploadfile) !== (int) $origin_id) {
|
||||
alert('잘못된 접근입니다.');
|
||||
}
|
||||
@unlink(config_item('uploads_dir') . '/files/' . element('ufi_filename', $olduploadfile));
|
||||
$this->Upload_file_model->delete($key);
|
||||
$file_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata('message','정상적으로 삭제되었습니다');
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
504
application/controllers/admin/contents/Qna.php
Normal file
504
application/controllers/admin/contents/Qna.php
Normal file
@@ -0,0 +1,504 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Qna class
|
||||
*/
|
||||
|
||||
class Qna extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/qna';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Qna', 'Upload_file', 'Apps');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Qna_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'dhtml_editor');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('app_id','qna_title','qna_content'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('app_id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('qna_id'); // 정렬이 가능한 필드
|
||||
$where = array();
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['qna.app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('qna_title' => '제목','qna_content' => '내용');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
} else if ($this->input->get('app_id')) {
|
||||
$getdata['app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
$view['view']['upload_file_count'] = $upload_file_count = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array('field' => 'app_id', 'label' => '어플이름', 'rules' => 'trim|required'),
|
||||
array('field' => 'qna_title', 'label' => '제목', 'rules' => 'trim|required'),
|
||||
array('field' => 'qna_content', 'label' => '문의내용', 'rules' => 'trim|required'),
|
||||
array('field' => 'qna_answer', 'label' => ' 답변내용', 'rules' => 'trim|required'),
|
||||
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
$form_validation = $this->form_validation->run();
|
||||
$file_error = '';
|
||||
|
||||
|
||||
$uploadfiledata = '';
|
||||
$uploadfiledata2 = '';
|
||||
if ($upload_file_count > 0 && $form_validation) {
|
||||
$this->load->library('upload');
|
||||
if (isset($_FILES) && isset($_FILES['upload_file']) && isset($_FILES['upload_file']['name']) && is_array($_FILES['upload_file']['name'])) {
|
||||
$filecount = count($_FILES['upload_file']['name']);
|
||||
$upload_path = config_item('uploads_dir') . '/files/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
foreach ($_FILES['upload_file']['name'] as $i => $value) {
|
||||
if ($value) {
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = '*';
|
||||
$uploadconfig['max_size'] = 10240;
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
$_FILES['userfile']['name'] = $_FILES['upload_file']['name'][$i];
|
||||
$_FILES['userfile']['type'] = $_FILES['upload_file']['type'][$i];
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['upload_file']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['upload_file']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['upload_file']['size'][$i];
|
||||
if ($this->upload->do_upload()) {
|
||||
$filedata = $this->upload->data();
|
||||
|
||||
$uploadfiledata[$i]['ufi_filename'] = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $filedata);
|
||||
$uploadfiledata[$i]['ufi_originname'] = element('orig_name', $filedata);
|
||||
$uploadfiledata[$i]['ufi_filesize'] = intval(element('file_size', $filedata) * 1024);
|
||||
$uploadfiledata[$i]['ufi_width'] = element('image_width', $filedata) ? element('image_width', $filedata) : 0;
|
||||
$uploadfiledata[$i]['ufi_height'] = element('image_height', $filedata) ? element('image_height', $filedata) : 0;
|
||||
$uploadfiledata[$i]['ufi_type'] = str_replace('.', '', element('file_ext', $filedata));
|
||||
$uploadfiledata[$i]['is_image'] = element('is_image', $filedata) ? element('is_image', $filedata) : 0;
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_FILES) && isset($_FILES['upload_file_update'])
|
||||
&& isset($_FILES['upload_file_update']['name'])
|
||||
&& is_array($_FILES['upload_file_update']['name'])
|
||||
&& $file_error === '') {
|
||||
$filecount = count($_FILES['upload_file_update']['name']);
|
||||
$upload_path = config_item('uploads_dir') . '/files/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
foreach ($_FILES['upload_file_update']['name'] as $i => $value) {
|
||||
if ($value) {
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = '*';
|
||||
$uploadconfig['max_size'] = 10240;
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
$this->upload->initialize($uploadconfig);
|
||||
$_FILES['userfile']['name'] = $_FILES['upload_file_update']['name'][$i];
|
||||
$_FILES['userfile']['type'] = $_FILES['upload_file_update']['type'][$i];
|
||||
$_FILES['userfile']['tmp_name'] = $_FILES['upload_file_update']['tmp_name'][$i];
|
||||
$_FILES['userfile']['error'] = $_FILES['upload_file_update']['error'][$i];
|
||||
$_FILES['userfile']['size'] = $_FILES['upload_file_update']['size'][$i];
|
||||
if ($this->upload->do_upload()) {
|
||||
$filedata = $this->upload->data();
|
||||
|
||||
$olduploadfile = $this->Upload_file_model->get_one($i);
|
||||
if ((int) element('origin_id', $olduploadfile) !== (int) element('qna_id', $getdata)) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
@unlink(config_item('uploads_dir') . '/files/' . element('ufi_filename', $oldpostfile));
|
||||
|
||||
$uploadfiledata2[$i]['ufi_id'] = $i;
|
||||
$uploadfiledata2[$i]['ufi_filename'] = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $filedata);
|
||||
$uploadfiledata2[$i]['ufi_originname'] = element('orig_name', $filedata);
|
||||
$uploadfiledata2[$i]['ufi_filesize'] = intval(element('file_size', $filedata) * 1024);
|
||||
$uploadfiledata2[$i]['ufi_width'] = element('image_width', $filedata)
|
||||
? element('image_width', $filedata) : 0;
|
||||
$uploadfiledata2[$i]['ufi_height'] = element('image_height', $filedata)
|
||||
? element('image_height', $filedata) : 0;
|
||||
$uploadfiledata2[$i]['ufi_type'] = str_replace('.', '', element('file_ext', $filedata));
|
||||
$uploadfiledata2[$i]['is_image'] = element('is_image', $filedata)
|
||||
? element('is_image', $filedata) : 0;
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($form_validation === false OR $file_error !== '') {
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
if (element('qna_id', $getdata)) {
|
||||
$uploadwhere = array(
|
||||
'origin_table' => 'qna',
|
||||
'origin_id' => element('qna_id', $getdata),
|
||||
);
|
||||
$view['view']['file'] = $file = $this->Upload_file_model->get('', '', $uploadwhere, '', '', 'ufi_id', 'ASC');
|
||||
if ($file && is_array($file)) {
|
||||
foreach ($file as $key => $value) {
|
||||
$view['view']['file'][$key]['download_link']
|
||||
= site_url('download/downfiles/' . element('ufi_id', $value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$updatedata = array(
|
||||
'app_id' => $this->input->post('app_id', null, ''),
|
||||
'qna_title' => $this->input->post('qna_title', null, ''),
|
||||
'qna_content' => $this->input->post('qna_content', null, ''),
|
||||
'qna_answer' => $this->input->post('qna_answer', null, ''),
|
||||
|
||||
);
|
||||
if ($this->input->post('qna_answer')) {
|
||||
$updatedata['answer_at'] = cdate('Y-m-d H:i:s');
|
||||
$updatedata['has_answer'] = '1';
|
||||
} else {
|
||||
$updatedata['answer_at'] = null;
|
||||
$updatedata['has_answer'] = '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
$this->{$this->modelname}->update($this->input->post($primary_key), $updatedata);
|
||||
$origin_id = $this->input->post($primary_key);
|
||||
$this->session->set_flashdata('message','정상적으로 수정되었습니다');
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('write');
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
|
||||
$updatedata['user_id'] = $this->userlib->item('user_id');
|
||||
$updatedata['user_name'] = $this->userlib->item('user_username');
|
||||
$origin_id = $this->{$this->modelname}->insert($updatedata);
|
||||
$this->session->set_flashdata('message','정상적으로 입력되었습니다');
|
||||
}
|
||||
|
||||
|
||||
$file_updated = false;
|
||||
$file_changed = false;
|
||||
if (is_array($uploadfiledata) && count($uploadfiledata) > 0) {
|
||||
foreach ($uploadfiledata as $pkey => $pval) {
|
||||
if ($pval) {
|
||||
$fileupdate = array(
|
||||
'origin_id' => $origin_id,
|
||||
'origin_table' => 'qna',
|
||||
'user_id' => $this->userlib->item('user_id'),
|
||||
'ufi_originname' => element('ufi_originname', $pval),
|
||||
'ufi_filename' => element('ufi_filename', $pval),
|
||||
'ufi_filesize' => element('ufi_filesize', $pval),
|
||||
'ufi_width' => element('ufi_width', $pval),
|
||||
'ufi_height' => element('ufi_height', $pval),
|
||||
'ufi_type' => element('ufi_type', $pval),
|
||||
'ufi_is_image' => element('is_image', $pval),
|
||||
'ufi_datetime' => cdate('Y-m-d H:i:s'),
|
||||
'ufi_ip' => $this->input->ip_address(),
|
||||
);
|
||||
$file_id = $this->Upload_file_model->insert($fileupdate);
|
||||
$file_updated = true;
|
||||
}
|
||||
}
|
||||
$file_changed = true;
|
||||
}
|
||||
if (is_array($uploadfiledata2) && count($uploadfiledata2) > 0) {
|
||||
foreach ($uploadfiledata2 as $pkey => $pval) {
|
||||
if ($pval) {
|
||||
$fileupdate = array(
|
||||
'user_id' => $this->userlib->item('user_id'),
|
||||
'ufi_originname' => element('ufi_originname', $pval),
|
||||
'ufi_filename' => element('ufi_filename', $pval),
|
||||
'ufi_filesize' => element('ufi_filesize', $pval),
|
||||
'ufi_width' => element('ufi_width', $pval),
|
||||
'ufi_height' => element('ufi_height', $pval),
|
||||
'ufi_type' => element('ufi_type', $pval),
|
||||
'ufi_is_image' => element('is_image', $pval),
|
||||
'ufi_datetime' => cdate('Y-m-d H:i:s'),
|
||||
'ufi_ip' => $this->input->ip_address(),
|
||||
);
|
||||
$this->Upload_file_model->update($pkey, $fileupdate);
|
||||
$file_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->input->post('upload_file_del')) {
|
||||
foreach ($this->input->post('upload_file_del') as $key => $val) {
|
||||
if ($val === '1' && ! isset($uploadfiledata2[$key])) {
|
||||
$olduploadfile = $this->Upload_file_model->get_one($key);
|
||||
if ( ! element('origin_id', $olduploadfile) OR (int) element('origin_id', $olduploadfile) !== (int) $origin_id) {
|
||||
alert('잘못된 접근입니다.');
|
||||
}
|
||||
@unlink(config_item('uploads_dir') . '/files/' . element('ufi_filename', $olduploadfile));
|
||||
$this->Upload_file_model->delete($key);
|
||||
$file_changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->{$this->modelname}->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata('message','정상적으로 삭제되었습니다');
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
163
application/controllers/admin/contents/Tag.php
Normal file
163
application/controllers/admin/contents/Tag.php
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Tag class
|
||||
*/
|
||||
|
||||
class Tag extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'contents/tag';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Contents_tag', 'Apps', 'Contents_category');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Contents_tag_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
|
||||
$view['view']['sort'] = array(
|
||||
'tag_id' => $param->sort('tag_id', 'desc'),
|
||||
'tag_name' => $param->sort('tag_name', 'asc'),
|
||||
'cnt' => $param->sort('cnt', 'desc'),
|
||||
);
|
||||
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('tag_name'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array(); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('tag_id', 'tag_name', 'cnt'); // 정렬이 가능한 필드
|
||||
$where = array();
|
||||
if ($this->input->get('app_id')) {
|
||||
$where['app_id'] = $this->input->get('app_id');
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('tag_name' => '태그명');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$getdata = $this->{$this->modelname}->get_one($val);
|
||||
$where = array(
|
||||
'tag_name' => element('tag_name', $getdata),
|
||||
);
|
||||
$this->{$this->modelname}->delete('', $where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
142
application/controllers/admin/reserve/Reserve.php
Normal file
142
application/controllers/admin/reserve/Reserve.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Reserve class
|
||||
*/
|
||||
|
||||
class Reserve extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'reserve/reserve';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Contents_category', 'Apps');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Contents_category_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
|
||||
$app_id = $this->input->get('app_id');
|
||||
|
||||
if ($app_id) {
|
||||
$where = array(
|
||||
'cat_parent' => '0',
|
||||
'app_id' => $app_id,
|
||||
);
|
||||
$result = $this->{$this->modelname}->get('', '', $where, '', '', 'cat_sort', 'desc');
|
||||
$view['view']['data'] = $result;
|
||||
}
|
||||
$view['view']['applist'] = $this->Apps_model->app_list();
|
||||
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($app_id = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
|
||||
if (! $this->input->post('is_submit')) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
$cat_time = $this->input->post('cat_publish_time');
|
||||
if ($cat_time) {
|
||||
foreach ($cat_time as $key => $value) {
|
||||
|
||||
if ($value) {
|
||||
$updatedata = array(
|
||||
'cat_publish_time' => $value,
|
||||
);
|
||||
} else {
|
||||
$updatedata = array(
|
||||
'cat_publish_time' => null,
|
||||
);
|
||||
}
|
||||
$upwhere = array(
|
||||
'cat_id' => $key,
|
||||
);
|
||||
$this->{$this->modelname}->update('', $updatedata, $upwhere);
|
||||
}
|
||||
}
|
||||
|
||||
$this->session->set_flashdata('message','정상적으로 수정되었습니다');
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?app_id=' . $this->input->post('app_id'));
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
327
application/controllers/admin/user/Pushsend.php
Normal file
327
application/controllers/admin/user/Pushsend.php
Normal file
@@ -0,0 +1,327 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Pushsend class
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pushsend controller 입니다.
|
||||
*/
|
||||
class Pushsend extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 마이샵 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'user/pushsend';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('Fcm_result');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'Fcm_result_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'chkstring');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->{$this->modelname}->primary_key;
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('id', 'user_id'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('id'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('id'); // 정렬이 가능한 필드
|
||||
|
||||
$where = array();
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('id' => '고유번호');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($pid = 0)
|
||||
{
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
if ( ! function_exists('password_hash')) {
|
||||
$this->load->helper('password');
|
||||
}
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'sendto',
|
||||
'label' => '발송방법',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_token',
|
||||
'label' => '토큰',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'title',
|
||||
'label' => '제목',
|
||||
'rules' => 'trim|required',
|
||||
),
|
||||
array(
|
||||
'field' => 'message',
|
||||
'label' => '내용',
|
||||
'rules' => 'trim',
|
||||
)
|
||||
);
|
||||
$this->form_validation->set_rules($config);
|
||||
|
||||
|
||||
//현재 설정 key 가져오기
|
||||
$this->load->config('fcm');
|
||||
$view['view']['fcm_api_key'] = $this->config->item('fcm_api_key');
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($this->form_validation->run() === false) {
|
||||
|
||||
|
||||
//기본값
|
||||
if(!element('message', $getdata)) {
|
||||
$getdata['message'] = '';
|
||||
}
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
//primary key 정보를 저장합니다
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
|
||||
//어드민 레이아웃을 정의합니다
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
$updatedata = array(
|
||||
'sendto' => $this->input->post('sendto', null, ''),
|
||||
'topic' => $this->input->post('topic', null, ''),
|
||||
'user_id' => $this->input->post('user_id', null, ''),
|
||||
'user_token' => $this->input->post('user_token', null, ''),
|
||||
'title' => $this->input->post('title', null, ''),
|
||||
'message' => $this->input->post('message', null, ''),
|
||||
);
|
||||
|
||||
//게시물 수정
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$as_id = $this->input->post($primary_key);
|
||||
$this->{$this->modelname}->update($as_id, $updatedata);
|
||||
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 수정되었습니다'
|
||||
);
|
||||
} else {
|
||||
//$this->accesslevel->check_admin('write');//20170602 에러 발생하여 주석처리 함
|
||||
|
||||
//푸시발송
|
||||
$this->load->library('Fcm_library');
|
||||
|
||||
//변수 정리
|
||||
$sendto = $this->input->post('sendto');
|
||||
$topic = $this->input->post('topic');
|
||||
$user_id = $this->input->post('user_id');
|
||||
$user_token = $this->input->post('user_token');
|
||||
$title = $this->input->post('title');
|
||||
$message = $this->input->post('message');
|
||||
|
||||
|
||||
//전체발송일 경우 처리
|
||||
//앱에서 FCM 처리가 되지 않아 전체 FOR문을 돌리는 것으로 대체함
|
||||
//20170420
|
||||
if($sendto == 'topic') {
|
||||
$all_user_token = $this->db->select('user_userid, user_fcm_token')->where("user_fcm_token != ", "")->where("user_use_push", "1")->get("user")->result_array();
|
||||
if($all_user_token) {
|
||||
foreach($all_user_token as $k => $v) {
|
||||
$sendto = 'token';
|
||||
$topic = '';
|
||||
$user_id = $v['user_userid'];
|
||||
$user_token = $v['user_fcm_token'];
|
||||
|
||||
if(strlen($user_token) < 100) continue;
|
||||
|
||||
$this->fcm_library->send($sendto, $topic, $user_id, $user_token, $title, $message);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->fcm_library->send($sendto, $topic, $user_id, $user_token, $title, $message);
|
||||
}
|
||||
|
||||
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 입력되었습니다'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->Fcm_result_model->delete($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
952
application/controllers/admin/user/Users.php
Normal file
952
application/controllers/admin/user/Users.php
Normal file
@@ -0,0 +1,952 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Users class
|
||||
*/
|
||||
|
||||
/**
|
||||
* 관리자>회원설정>회원관리 controller 입니다.
|
||||
*/
|
||||
class Users extends MY_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* 관리자 페이지 상의 현재 디렉토리입니다
|
||||
* 페이지 이동시 필요한 정보입니다
|
||||
*/
|
||||
public $pagedir = 'user/users';
|
||||
|
||||
/**
|
||||
* 모델을 로딩합니다
|
||||
*/
|
||||
protected $models = array('User_meta', 'Social_meta', 'Apps');
|
||||
|
||||
/**
|
||||
* 이 컨트롤러의 메인 모델 이름입니다
|
||||
*/
|
||||
protected $modelname = 'User_model';
|
||||
|
||||
/**
|
||||
* 헬퍼를 로딩합니다
|
||||
*/
|
||||
protected $helpers = array('form', 'array', 'chkstring');
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
/**
|
||||
* 라이브러리를 로딩합니다
|
||||
*/
|
||||
$this->load->library(array('pagination', 'querystring'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록을 가져오는 메소드입니다
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$page = (((int) $this->input->get('page')) > 0) ? ((int) $this->input->get('page')) : 1;
|
||||
$view['view']['sort'] = array(
|
||||
'user_id' => $param->sort('user_id', 'asc'),
|
||||
'user_username' => $param->sort('user_username', 'asc'),
|
||||
'user_email' => $param->sort('user_email', 'asc'),
|
||||
'user_register_datetime' => $param->sort('user_register_datetime', 'asc'),
|
||||
'user_lastlogin_datetime' => $param->sort('user_lastlogin_datetime', 'asc'),
|
||||
);
|
||||
$findex = $this->input->get('findex', null, 'user.user_id');
|
||||
$forder = $this->input->get('forder', null, 'desc');
|
||||
$sfield = $this->input->get('sfield', null, '');
|
||||
$skeyword = $this->input->get('skeyword', null, '');
|
||||
|
||||
$per_page = admin_listnum();
|
||||
$offset = ($page - 1) * $per_page;
|
||||
|
||||
/**
|
||||
* 게시판 목록에 필요한 정보를 가져옵니다.
|
||||
*/
|
||||
$this->{$this->modelname}->allow_search_field = array('user_id', 'user_email', 'user_username', 'user_homepage', 'user_register_datetime', 'user_register_ip', 'user_lastlogin_datetime', 'user_lastlogin_ip', 'user_is_admin'); // 검색이 가능한 필드
|
||||
$this->{$this->modelname}->search_field_equal = array('user_id', 'user_is_admin'); // 검색중 like 가 아닌 = 검색을 하는 필드
|
||||
$this->{$this->modelname}->allow_order_field = array('user.user_id', 'user_username', 'user_email', 'user_register_datetime', 'user_lastlogin_datetime'); // 정렬이 가능한 필드
|
||||
|
||||
$where = array();
|
||||
if ($this->input->get('user_is_admin')) {
|
||||
$where['user_is_admin'] = 1;
|
||||
}
|
||||
if ($this->input->get('user_denied')) {
|
||||
$where['user_denied'] = 1;
|
||||
}
|
||||
$result = $this->{$this->modelname}
|
||||
->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
|
||||
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
|
||||
|
||||
if (element('list', $result)) {
|
||||
foreach (element('list', $result) as $key => $val) {
|
||||
|
||||
$result['list'][$key]['display_name'] = display_username(
|
||||
element('user_username', $val)
|
||||
);
|
||||
$result['list'][$key]['meta'] = $this->User_meta_model->get_all_meta(element('user_id', $val));
|
||||
$result['list'][$key]['social'] = $this->Social_meta_model->get_all_meta(element('user_id', $val));
|
||||
if (element('app_id', $val)) {
|
||||
$result['list'][$key]['apps'] = $this->Apps_model->get_one(element('app_id', $val));
|
||||
}
|
||||
|
||||
$result['list'][$key]['num'] = $list_num--;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['data'] = $result;
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 페이지네이션을 생성합니다
|
||||
*/
|
||||
$config['base_url'] = admin_url($this->pagedir) . '?' . $param->replace('page');
|
||||
$config['total_rows'] = $result['total_rows'];
|
||||
$config['per_page'] = $per_page;
|
||||
$this->pagination->initialize($config);
|
||||
$view['view']['paging'] = $this->pagination->create_links();
|
||||
$view['view']['page'] = $page;
|
||||
|
||||
/**
|
||||
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
|
||||
*/
|
||||
$search_option = array('user_email' => '이메일', 'user_username' => '회원명', 'user_homepage' => '홈페이지', 'user_register_datetime' => '회원가입날짜', 'user_register_ip' => '회원가입IP', 'user_lastlogin_datetime' => '최종로그인날짜', 'user_lastlogin_ip' => '최종로그인IP', 'user_adminmemo' => '관리자메모');
|
||||
$view['view']['skeyword'] = ($sfield && array_key_exists($sfield, $search_option)) ? $skeyword : '';
|
||||
$view['view']['search_option'] = search_option($search_option, $sfield);
|
||||
$view['view']['listall_url'] = admin_url($this->pagedir);
|
||||
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
|
||||
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시판 글쓰기 또는 수정 페이지를 가져오는 메소드입니다
|
||||
*/
|
||||
public function write($pid = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
/**
|
||||
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
|
||||
*/
|
||||
if ($pid) {
|
||||
$pid = (int) $pid;
|
||||
if (empty($pid) OR $pid < 1) {
|
||||
show_404();
|
||||
}
|
||||
}
|
||||
$primary_key = $this->{$this->modelname}->primary_key;
|
||||
|
||||
/**
|
||||
* 수정 페이지일 경우 기존 데이터를 가져옵니다
|
||||
*/
|
||||
$getdata = array();
|
||||
if ($pid) {
|
||||
$getdata = $this->{$this->modelname}->get_one($pid);
|
||||
$getdata['meta'] = $this->User_meta_model->get_all_meta($pid);
|
||||
}
|
||||
$registerform = $this->configlib->item('registerform');
|
||||
$form = json_decode($registerform, true);
|
||||
|
||||
/**
|
||||
* Validation 라이브러리를 가져옵니다
|
||||
*/
|
||||
$this->load->library('form_validation');
|
||||
|
||||
if ( ! function_exists('password_hash')) {
|
||||
$this->load->helper('password');
|
||||
}
|
||||
|
||||
/**
|
||||
* 전송된 데이터의 유효성을 체크합니다
|
||||
*/
|
||||
$config = array(
|
||||
array(
|
||||
'field' => 'user_username',
|
||||
'label' => '이름',
|
||||
'rules' => 'trim|min_length[2]|max_length[20]|callback__user_username_check',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_homepage',
|
||||
'label' => '홈페이지',
|
||||
'rules' => 'valid_url',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_birthday',
|
||||
'label' => '생일',
|
||||
'rules' => 'trim|exact_length[10]',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_sex',
|
||||
'label' => '성별',
|
||||
'rules' => 'trim|exact_length[1]',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_phone',
|
||||
'label' => '전화번호',
|
||||
'rules' => 'trim|valid_phone',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_zipcode',
|
||||
'label' => '우편번호',
|
||||
'rules' => 'trim|min_length[5]|max_length[7]',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_address1',
|
||||
'label' => '기본주소',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_address2',
|
||||
'label' => '상세주소',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_address3',
|
||||
'label' => '참고항목',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_address4',
|
||||
'label' => '지번',
|
||||
'rules' => 'trim',
|
||||
),
|
||||
array(
|
||||
'field' => 'user_receive_email',
|
||||
'label' => '이메일수신여부',
|
||||
'rules' => 'trim|exact_length[1]',
|
||||
),
|
||||
);
|
||||
if ($this->input->post($primary_key)) {
|
||||
$config[] = array(
|
||||
'field' => 'user_password',
|
||||
'label' => '패스워드',
|
||||
'rules' => 'trim|min_length[4]',
|
||||
);
|
||||
$config[] = array(
|
||||
'field' => 'user_email',
|
||||
'label' => '회원이메일',
|
||||
'rules' => 'trim|required|valid_email|is_unique[user.user_email.user_id.' . element('user_id', $getdata) . ']',
|
||||
);
|
||||
} else {
|
||||
$config[] = array(
|
||||
'field' => 'user_password',
|
||||
'label' => '패스워드',
|
||||
'rules' => 'trim|required|min_length[4]',
|
||||
);
|
||||
$config[] = array(
|
||||
'field' => 'user_email',
|
||||
'label' => '회원이메일',
|
||||
'rules' => 'trim|required|valid_email|is_unique[user.user_email]',
|
||||
);
|
||||
}
|
||||
$this->form_validation->set_rules($config);
|
||||
$form_validation = $this->form_validation->run();
|
||||
$file_error = '';
|
||||
$updatephoto = '';
|
||||
$file_error2 = '';
|
||||
$updateicon = '';
|
||||
|
||||
if ($form_validation) {
|
||||
$this->load->library('upload');
|
||||
if (isset($_FILES) && isset($_FILES['user_photo']) && isset($_FILES['user_photo']['name']) && $_FILES['user_photo']['name']) {
|
||||
$upload_path = config_item('uploads_dir') . '/user_photo/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
|
||||
$uploadconfig['max_size'] = '2000';
|
||||
$uploadconfig['max_width'] = '1000';
|
||||
$uploadconfig['max_height'] = '1000';
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
|
||||
if ($this->upload->do_upload('user_photo')) {
|
||||
$img = $this->upload->data();
|
||||
$updatephoto = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $img);
|
||||
} else {
|
||||
$file_error = $this->upload->display_errors();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_FILES)
|
||||
&& isset($_FILES['user_icon'])
|
||||
&& isset($_FILES['user_icon']['name'])
|
||||
&& $_FILES['user_icon']['name']) {
|
||||
$upload_path = config_item('uploads_dir') . '/user_icon/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('Y') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$upload_path .= cdate('m') . '/';
|
||||
if (is_dir($upload_path) === false) {
|
||||
mkdir($upload_path, 0707);
|
||||
$file = $upload_path . 'index.php';
|
||||
$f = @fopen($file, 'w');
|
||||
@fwrite($f, '');
|
||||
@fclose($f);
|
||||
@chmod($file, 0644);
|
||||
}
|
||||
$uploadconfig = '';
|
||||
$uploadconfig['upload_path'] = $upload_path;
|
||||
$uploadconfig['allowed_types'] = 'jpg|jpeg|png|gif';
|
||||
$uploadconfig['max_size'] = '2000';
|
||||
$uploadconfig['max_width'] = '1000';
|
||||
$uploadconfig['max_height'] = '1000';
|
||||
$uploadconfig['encrypt_name'] = true;
|
||||
|
||||
$this->upload->initialize($uploadconfig);
|
||||
|
||||
if ($this->upload->do_upload('user_icon')) {
|
||||
$img = $this->upload->data();
|
||||
$updateicon = cdate('Y') . '/' . cdate('m') . '/' . element('file_name', $img);
|
||||
} else {
|
||||
$file_error2 = $this->upload->display_errors();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
|
||||
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
|
||||
*/
|
||||
if ($form_validation === false OR $file_error !== '' OR $file_error2 !== '') {
|
||||
|
||||
|
||||
$view['view']['message'] = $file_error . $file_error2;
|
||||
|
||||
$view['view']['data'] = $getdata;
|
||||
|
||||
if (empty($pid)) {
|
||||
$view['view']['data']['user_receive_email'] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* primary key 정보를 저장합니다
|
||||
*/
|
||||
$view['view']['primary_key'] = $primary_key;
|
||||
|
||||
$html_content = '';
|
||||
$k = 0;
|
||||
if ($form && is_array($form)) {
|
||||
foreach ($form as $key => $value) {
|
||||
if ( ! element('use', $value)) {
|
||||
continue;
|
||||
}
|
||||
if (element('func', $value) === 'basic') {
|
||||
continue;
|
||||
}
|
||||
$required = element('required', $value) ? 'required' : '';
|
||||
|
||||
$item = element(element('field_name', $value), element('extras', $getdata));
|
||||
$html_content[$k]['field_name'] = element('field_name', $value);
|
||||
$html_content[$k]['display_name'] = element('display_name', $value);
|
||||
$html_content[$k]['input'] = '';
|
||||
|
||||
//field_type : text, url, email, phone, textarea, radio, select, checkbox, date
|
||||
if (element('field_type', $value) === 'text'
|
||||
OR element('field_type', $value) === 'url'
|
||||
OR element('field_type', $value) === 'email'
|
||||
OR element('field_type', $value) === 'phone'
|
||||
OR element('field_type', $value) === 'date') {
|
||||
if (element('field_type', $value) === 'date') {
|
||||
$html_content[$k]['input'] .= '<input type="text" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control datepicker" value="' . set_value(element('field_name', $value), $item) . '" readonly="readonly" ' . $required . ' />';
|
||||
} elseif (element('field_type', $value) === 'phone') {
|
||||
$html_content[$k]['input'] .= '<input type="text" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control validphone" value="' . set_value(element('field_name', $value), $item) . '" ' . $required . ' />';
|
||||
} else {
|
||||
$html_content[$k]['input'] .= '<input type="' . element('field_type', $value) . '" id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control" value="' . set_value(element('field_name', $value), $item) . '" ' . $required . ' />';
|
||||
}
|
||||
} elseif (element('field_type', $value) === 'textarea') {
|
||||
$html_content[$k]['input'] .= '<textarea id="' . element('field_name', $value) . '" name="' . element('field_name', $value) . '" class="form-control" ' . $required . ' >' . set_value(element('field_name', $value), $item) . '</textarea>';
|
||||
} elseif (element('field_type', $value) === 'radio') {
|
||||
$html_content[$k]['input'] .= '<div class="checkbox">';
|
||||
$options = explode("\n", element('options', $value));
|
||||
$i =1;
|
||||
if ($options) {
|
||||
foreach ($options as $okey => $oval) {
|
||||
$oval = trim($oval);
|
||||
$radiovalue = (element('field_name', $value) === 'user_sex') ? $okey : $oval;
|
||||
$html_content[$k]['input'] .= '<label for="' . element('field_name', $value) . '_' . $i . '"><input type="radio" name="' . element('field_name', $value) . '" id="' . element('field_name', $value) . '_' . $i . '" value="' . $radiovalue . '" ' . set_radio(element('field_name', $value), $radiovalue, ($item === $radiovalue ? true : false)) . ' /> ' . $oval . ' </label> ';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$html_content[$k]['input'] .= '</div>';
|
||||
} elseif (element('field_type', $value) === 'checkbox') {
|
||||
$html_content[$k]['input'] .= '<div class="checkbox">';
|
||||
$options = explode("\n", element('options', $value));
|
||||
$item = json_decode($item, true);
|
||||
$i =1;
|
||||
if ($options) {
|
||||
foreach ($options as $okey => $oval) {
|
||||
$oval = trim($oval);
|
||||
$chkvalue = is_array($item) && in_array($oval, $item) ? $oval : '';
|
||||
$html_content[$k]['input'] .= '<label for="' . element('field_name', $value) . '_' . $i . '"><input type="checkbox" name="' . element('field_name', $value) . '[]" id="' . element('field_name', $value) . '_' . $i . '" value="' . $oval . '" ' . set_checkbox(element('field_name', $value), $oval, ($chkvalue ? true : false)) . ' /> ' . $oval . ' </label> ';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$html_content[$k]['input'] .= '</div>';
|
||||
} elseif (element('field_type', $value) === 'select') {
|
||||
$html_content[$k]['input'] .= '<div class="input-group">';
|
||||
$html_content[$k]['input'] .= '<select name="' . element('field_name', $value) . '" class="form-control" ' . $required . '>';
|
||||
$html_content[$k]['input'] .= '<option value="" >선택하세요</option> ';
|
||||
$options = explode("\n", element('options', $value));
|
||||
if ($options) {
|
||||
foreach ($options as $okey => $oval) {
|
||||
$oval = trim($oval);
|
||||
$html_content[$k]['input'] .= '<option value="' . $oval . '" ' . set_select(element('field_name', $value), $oval, ($item === $oval ? true : false)) . ' >' . $oval . '</option> ';
|
||||
}
|
||||
}
|
||||
$html_content[$k]['input'] .= '</select>';
|
||||
$html_content[$k]['input'] .= '</div>';
|
||||
}
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
|
||||
$view['view']['html_content'] = $html_content;
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout', 'skin' => 'write');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
|
||||
} else {
|
||||
/**
|
||||
* 유효성 검사를 통과한 경우입니다.
|
||||
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
|
||||
*/
|
||||
|
||||
|
||||
$user_sex = $this->input->post('user_sex') ? $this->input->post('user_sex') : 0;
|
||||
$user_receive_email = $this->input->post('user_receive_email') ? 1 : 0;
|
||||
$user_email_cert = $this->input->post('user_email_cert') ? 1 : 0;
|
||||
$user_is_admin = $this->input->post('user_is_admin') ? $this->input->post('user_is_admin') : 0;
|
||||
|
||||
$updatedata = array(
|
||||
'user_email' => $this->input->post('user_email', null, ''),
|
||||
'user_username' => $this->input->post('user_username', null, ''),
|
||||
'user_homepage' => $this->input->post('user_homepage', null, ''),
|
||||
'user_birthday' => $this->input->post('user_birthday', null, ''),
|
||||
'user_phone' => $this->input->post('user_phone', null, ''),
|
||||
'user_sex' => $user_sex,
|
||||
'user_zipcode' => $this->input->post('user_zipcode', null, ''),
|
||||
'user_address1' => $this->input->post('user_address1', null, ''),
|
||||
'user_address2' => $this->input->post('user_address2', null, ''),
|
||||
'user_address3' => $this->input->post('user_address3', null, ''),
|
||||
'user_address4' => $this->input->post('user_address4', null, ''),
|
||||
'user_receive_email' => $user_receive_email,
|
||||
'user_denied' => $this->input->post('user_denied', null, ''),
|
||||
'user_email_cert' => $user_email_cert,
|
||||
'user_is_admin' => $user_is_admin,
|
||||
'user_adminmemo' => $this->input->post('user_adminmemo', null, ''),
|
||||
);
|
||||
|
||||
$metadata = array();
|
||||
|
||||
if (empty($getdata['user_denied']) && $this->input->post('user_denied')) {
|
||||
$metadata['meta_denied_datetime'] = cdate('Y-m-d H:i:s');
|
||||
$metadata['meta_denied_by_user_id'] = $this->userlib->item('user_id');
|
||||
}
|
||||
if ( ! empty($getdata['user_denied']) && ! $this->input->post('user_denied')) {
|
||||
$metadata['meta_denied_datetime'] = '';
|
||||
$metadata['meta_denied_by_user_id'] = '';
|
||||
}
|
||||
if (empty($getdata['user_email_cert']) && $this->input->post('user_email_cert')) {
|
||||
$metadata['meta_email_cert_datetime'] = cdate('Y-m-d H:i:s');
|
||||
}
|
||||
if ( ! empty($getdata['user_email_cert']) && ! $this->input->post('user_email_cert')) {
|
||||
$metadata['meta_email_cert_datetime'] = '';
|
||||
}
|
||||
if (element('user_username', $getdata) !== $this->input->post('user_username')) {
|
||||
$updatedata['user_username'] = $this->input->post('user_username', null, '');
|
||||
$metadata['meta_username_datetime'] = cdate('Y-m-d H:i:s');
|
||||
}
|
||||
if ($this->input->post('user_password')) {
|
||||
$updatedata['user_password'] = password_hash($this->input->post('user_password'), PASSWORD_BCRYPT);
|
||||
}
|
||||
|
||||
if ($this->input->post('user_photo_del')) {
|
||||
$updatedata['user_photo'] = '';
|
||||
} elseif ($updatephoto) {
|
||||
$updatedata['user_photo'] = $updatephoto;
|
||||
}
|
||||
if (element('user_photo', $getdata) && ($this->input->post('user_photo_del') OR $updatephoto)) {
|
||||
// 기존 파일 삭제
|
||||
@unlink(config_item('uploads_dir') . '/user_photo/' . element('user_photo', $getdata));
|
||||
}
|
||||
if ($this->input->post('user_icon_del')) {
|
||||
$updatedata['user_icon'] = '';
|
||||
} elseif ($updateicon) {
|
||||
$updatedata['user_icon'] = $updateicon;
|
||||
}
|
||||
if (element('user_icon', $getdata) && ($this->input->post('user_icon_del') OR $updateicon)) {
|
||||
// 기존 파일 삭제
|
||||
@unlink(config_item('uploads_dir') . '/user_icon/' . element('user_icon', $getdata));
|
||||
}
|
||||
|
||||
/**
|
||||
* 게시물을 수정하는 경우입니다
|
||||
*/
|
||||
if ($this->input->post($primary_key)) {
|
||||
|
||||
$this->accesslevel->check_admin('edit');
|
||||
|
||||
$user_id = $this->input->post($primary_key);
|
||||
$this->{$this->modelname}->update($user_id, $updatedata);
|
||||
$this->User_meta_model->save($user_id, $metadata);
|
||||
|
||||
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 수정되었습니다'
|
||||
);
|
||||
} else {
|
||||
|
||||
$this->accesslevel->check_admin('write');
|
||||
|
||||
/**
|
||||
* 게시물을 새로 입력하는 경우입니다
|
||||
*/
|
||||
$updatedata['user_register_datetime'] = cdate('Y-m-d H:i:s');
|
||||
$updatedata['user_register_ip'] = $this->input->ip_address();
|
||||
|
||||
$user_id = $this->{$this->modelname}->insert($updatedata);
|
||||
|
||||
$this->User_meta_model->save($user_id, $metadata);
|
||||
|
||||
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 입력되었습니다'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게시물의 신규입력 또는 수정작업이 끝난 후 목록 페이지로 이동합니다
|
||||
*/
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 소셜 정보 자세히 보는 팝업페이지입니다
|
||||
*/
|
||||
public function socialinfo($socialtype = '', $user_id = 0)
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('read');
|
||||
|
||||
$view = array();
|
||||
$view['view'] = array();
|
||||
|
||||
|
||||
$this->load->model(array('Social_model', 'Social_meta_model'));
|
||||
|
||||
$social = array('facebook' => '페이스북', 'twitter' => '트위터', 'google' => '구글', 'naver' => '네이버', 'kakao' => '카카오');
|
||||
|
||||
$user_id = (int) $user_id;
|
||||
if (empty($user_id) OR $user_id < 1) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
if (empty($socialtype)) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
if ( ! element($socialtype, $social)) {
|
||||
alert('잘못된 접근입니다');
|
||||
}
|
||||
|
||||
$social_id = $this->Social_meta_model->get_social_id_by_user_id($socialtype, $user_id);
|
||||
|
||||
$swhere = array(
|
||||
'soc_type' => $socialtype,
|
||||
'soc_account_id' => $social_id,
|
||||
);
|
||||
$socialinfo = $this->Social_model->get('', '', $swhere, '', '', 'soc_id', 'ASC');
|
||||
$data = array();
|
||||
if ($socialinfo) {
|
||||
foreach ($socialinfo as $key => $value) {
|
||||
if ($value['soc_value']) {
|
||||
$data[$value['soc_key']] = $value['soc_value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$info = '';
|
||||
if ($socialtype === 'facebook') {
|
||||
$info = array(
|
||||
array(
|
||||
'key' => 'name',
|
||||
'text' => '성명',
|
||||
'value' => element('name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'last_name',
|
||||
'text' => '성',
|
||||
'value' => element('last_name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'first_name',
|
||||
'text' => '이름',
|
||||
'value' => element('first_name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'email',
|
||||
'text' => '이메일',
|
||||
'value' => element('email', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'link',
|
||||
'text' => '주소',
|
||||
'value' => '<a href="' . goto_url(element('link', $data)) . '" target="_blank">' . element('link', $data) . '</a>',
|
||||
),
|
||||
array(
|
||||
'key' => 'gender',
|
||||
'text' => '성별',
|
||||
'value' => (element('gender', $data) === 'male' ? '남성' : '여성'),
|
||||
),
|
||||
array(
|
||||
'key' => 'locale',
|
||||
'text' => '언어',
|
||||
'value' => element('locale', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'timezone',
|
||||
'text' => '타임존',
|
||||
'value' => element('timezone', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'update_datetime',
|
||||
'text' => '최종정보갱신일',
|
||||
'value' => element('update_datetime', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'ip_address',
|
||||
'text' => '최종접속IP',
|
||||
'value' => element('ip_address', $data),
|
||||
),
|
||||
);
|
||||
}
|
||||
if ($socialtype === 'twitter') {
|
||||
$info = array(
|
||||
array(
|
||||
'key' => 'name',
|
||||
'text' => '이름',
|
||||
'value' => element('name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'screen_name',
|
||||
'text' => '주소',
|
||||
'value' => element('screen_name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'url',
|
||||
'text' => 'URL',
|
||||
'value' => element('url', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'lang',
|
||||
'text' => '언어',
|
||||
'value' => element('lang', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'description',
|
||||
'text' => '설명',
|
||||
'value' => element('description', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'location',
|
||||
'text' => '지역',
|
||||
'value' => element('location', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'created_at',
|
||||
'text' => '트위터 생성일',
|
||||
'value' => element('created_at', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'update_datetime',
|
||||
'text' => '최종정보갱신일',
|
||||
'value' => element('update_datetime', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'ip_address',
|
||||
'text' => '최종접속IP',
|
||||
'value' => element('ip_address', $data),
|
||||
),
|
||||
);
|
||||
}
|
||||
if ($socialtype === 'google') {
|
||||
$info = array(
|
||||
array(
|
||||
'key' => 'name',
|
||||
'text' => '성명',
|
||||
'value' => element('name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'familyName',
|
||||
'text' => '성',
|
||||
'value' => element('familyName', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'givenName',
|
||||
'text' => '이름',
|
||||
'value' => element('givenName', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'email',
|
||||
'text' => '이메일',
|
||||
'value' => element('email', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'gender',
|
||||
'text' => '성별',
|
||||
'value' => (element('gender', $data) === 'male' ? '남성' : '여성'),
|
||||
),
|
||||
array(
|
||||
'key' => 'locale',
|
||||
'text' => '언어',
|
||||
'value' => element('locale', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'link',
|
||||
'text' => '주소',
|
||||
'value' => '<a href="' . goto_url(element('link', $data)) . '" target="_blank">' . element('link', $data) . '</a>',
|
||||
),
|
||||
array(
|
||||
'key' => 'picture',
|
||||
'text' => '사진',
|
||||
'value' => '<img src="' . element('picture', $data) . '" width="200" />',
|
||||
),
|
||||
array(
|
||||
'key' => 'update_datetime',
|
||||
'text' => '최종정보갱신일',
|
||||
'value' => element('update_datetime', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'ip_address',
|
||||
'text' => '최종접속IP',
|
||||
'value' => element('ip_address', $data),
|
||||
),
|
||||
);
|
||||
}
|
||||
if ($socialtype === 'naver') {
|
||||
$info = array(
|
||||
array(
|
||||
'key' => 'name',
|
||||
'text' => '이름',
|
||||
'value' => element('name', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'username',
|
||||
'text' => '회원명',
|
||||
'value' => element('username', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'email',
|
||||
'text' => '이메일',
|
||||
'value' => element('email', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'age',
|
||||
'text' => '연령',
|
||||
'value' => element('age', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'gender',
|
||||
'text' => '성별',
|
||||
'value' => (element('gender', $data) === 'F' ? '여성' : '남성'),
|
||||
),
|
||||
array(
|
||||
'key' => 'birthday',
|
||||
'text' => '생일',
|
||||
'value' => element('birthday', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'update_datetime',
|
||||
'text' => '최종정보갱신일',
|
||||
'value' => element('update_datetime', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'ip_address',
|
||||
'text' => '최종접속IP',
|
||||
'value' => element('ip_address', $data),
|
||||
),
|
||||
);
|
||||
}
|
||||
if ($socialtype === 'kakao') {
|
||||
$info = array(
|
||||
array(
|
||||
'key' => 'username',
|
||||
'text' => '회원명',
|
||||
'value' => element('username', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'profile_image',
|
||||
'text' => '프로필이미지',
|
||||
'value' => '<img src="' . element('profile_image', $data) . '" width="200" />'
|
||||
),
|
||||
array(
|
||||
'key' => 'thumbnail_image',
|
||||
'text' => '썸네일이미지',
|
||||
'value' => '<img src="' . element('thumbnail_image', $data) . '" width="200" />'
|
||||
),
|
||||
array(
|
||||
'key' => 'update_datetime',
|
||||
'text' => '최종정보갱신일',
|
||||
'value' => element('update_datetime', $data),
|
||||
),
|
||||
array(
|
||||
'key' => 'ip_address',
|
||||
'text' => '최종접속IP',
|
||||
'value' => element('ip_address', $data),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$view['view']['data'] = $info;
|
||||
$view['view']['socialtype'] = $socialtype;
|
||||
$view['view']['socialname'] = $social[$socialtype];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 어드민 레이아웃을 정의합니다
|
||||
*/
|
||||
$layoutconfig = array('layout' => 'layout_popup', 'skin' => 'socialinfo');
|
||||
$view['layout'] = $this->layoutlib->admin($layoutconfig, $this->configlib->get_device_view_type());
|
||||
$this->data = $view;
|
||||
$this->layout = element('layout_skin_file', element('layout', $view));
|
||||
$this->view = element('view_skin_file', element('layout', $view));
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 페이지에서 선택삭제를 하는 경우 실행되는 메소드입니다
|
||||
*/
|
||||
public function listdelete()
|
||||
{
|
||||
|
||||
$this->accesslevel->check_admin('delete');
|
||||
|
||||
/**
|
||||
* 체크한 게시물의 삭제를 실행합니다
|
||||
*/
|
||||
if ($this->input->post('chk') && is_array($this->input->post('chk'))) {
|
||||
foreach ($this->input->post('chk') as $val) {
|
||||
if ($val) {
|
||||
$this->userlib->delete_user($val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 삭제가 끝난 후 목록페이지로 이동합니다
|
||||
*/
|
||||
$this->session->set_flashdata(
|
||||
'message',
|
||||
'정상적으로 삭제되었습니다'
|
||||
);
|
||||
$param =& $this->querystring;
|
||||
$redirecturl = admin_url($this->pagedir . '?' . $param->output());
|
||||
|
||||
redirect($redirecturl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원명 체크함수입니다
|
||||
*/
|
||||
public function _user_username_check($str)
|
||||
{
|
||||
if (chkstring($str, _HANGUL_ + _ALPHABETIC_ + _NUMERIC_) === false) {
|
||||
$this->form_validation->set_message(
|
||||
'_user_username_check',
|
||||
'회원명은 공백없이 한글, 영문, 숫자만 입력 가능합니다'
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user