Files

261 lines
8.0 KiB
PHP

<?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));
}
}