Example #1
0
 function index()
 {
     $bo_table = $this->input->post('bo_table');
     if (!IS_MEMBER || !$bo_table) {
         show_404();
     }
     $board = $this->Basic_model->get_board($bo_table);
     if (!isset($board['bo_table'])) {
         alert_close('존재하지 않은 게시판입니다.');
     }
     $member = unserialize(MEMBER);
     if ($member['mb_id'] != $board['bo_admin']) {
         show_404();
     }
     $config = array(array('field' => 'bo_table', 'label' => 'TABLE', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean'), array('field' => 'token', 'label' => '토큰', 'rules' => 'trim|required'), array('field' => 'bo_subject', 'label' => '게시판 제목', 'rules' => 'trim|required|max_length[20]|xss_clean'), array('field' => 'bo_admin', 'label' => '게시판 관리자', 'rules' => 'trim|min_length[3]|max_length[20]|alpha_dash'));
     $this->load->library('form_validation');
     $this->form_validation->set_rules($config);
     if ($this->form_validation->run() == FALSE) {
         $head = array('title' => $board['bo_subject']);
         $data = array('token' => get_token(), 'bo_table' => $board['bo_table'], 'bo_admin' => $board['bo_admin'], 'bo_subject' => $board['bo_subject'], 'bo_insert_content' => $board['bo_insert_content'], 'bo_sort_field' => $board['bo_sort_field'], 'bo_count_write' => isset($board['bo_count_write']) ? number_format($board['bo_count_write']) : FALSE, 'bo_count_comment' => isset($board['bo_count_comment']) ? number_format($board['bo_count_comment']) : FALSE, 'bo_count_delete' => $board['bo_count_delete'], 'bo_count_modify' => $board['bo_count_modify'], 'bo_use_secret' => $board['bo_use_secret'], 'bo_page_rows' => $board['bo_page_rows'], 'bo_page_rows_comt' => $board['bo_page_rows_comt'], 'bo_subject_len' => $board['bo_subject_len'], 'bo_new' => $board['bo_new'], 'bo_hot' => $board['bo_hot'], 'bo_image_width' => $board['bo_image_width'], 'bo_reply_order' => $board['bo_reply_order'], 'use_private_chk' => $board['bo_use_private'] ? "checked='checked'" : '', 'use_rss_chk' => $board['bo_use_rss'] ? "checked='checked'" : '', 'use_sns_chk' => $board['bo_use_sns'] ? "checked='checked'" : '', 'use_comment_chk' => $board['bo_use_comment'] ? "checked='checked'" : '', 'use_category_chk' => $board['bo_use_category'] ? "checked='checked'" : '', 'use_sideview_chk' => $board['bo_use_sideview'] ? "checked='checked'" : '', 'use_editor_chk' => $board['bo_use_editor'] ? "checked='checked'" : '', 'use_name_chk' => $board['bo_use_name'] ? "checked='checked'" : '', 'use_ip_view_chk' => $board['bo_use_ip_view'] ? "checked='checked'" : '', 'use_list_view_chk' => $board['bo_use_list_view'] ? "checked='checked'" : '', 'use_email_chk' => $board['bo_use_email'] ? "checked='checked'" : '', 'use_syntax_chk' => $board['bo_use_syntax'] ? "checked='checked'" : '', 'use_search_chk' => $board['bo_use_search'] ? "checked='checked'" : '', 'bo_list_level' => get_mb_level_select('bo_list_level', $board['bo_list_level'], '', $member['mb_level']), 'bo_read_level' => get_mb_level_select('bo_read_level', $board['bo_read_level'], '', $member['mb_level']), 'bo_write_level' => get_mb_level_select('bo_write_level', $board['bo_write_level'], '', $member['mb_level']), 'bo_reply_level' => get_mb_level_select('bo_reply_level', $board['bo_reply_level'], '', $member['mb_level']), 'bo_comment_level' => get_mb_level_select('bo_comment_level', $board['bo_comment_level'], '', $member['mb_level']), 'bo_upload_level' => get_mb_level_select('bo_upload_level', $board['bo_upload_level'], '', $member['mb_level']), 'bo_download_level' => get_mb_level_select('bo_download_level', $board['bo_download_level'], '', $member['mb_level']));
         widget::run('head', $head);
         $this->load->view('board/admin', $data);
         widget::run('tail');
     } else {
         check_token();
         // 이것을 Model로 해야 하는가 말아야 하는가
         $this->db->update('ki_board', array('bo_subject' => $this->input->post('bo_subject'), 'bo_list_level' => $this->input->post('bo_list_level'), 'bo_read_level' => $this->input->post('bo_read_level'), 'bo_write_level' => $this->input->post('bo_write_level'), 'bo_reply_level' => $this->input->post('bo_reply_level'), 'bo_comment_level' => $this->input->post('bo_comment_level'), 'bo_upload_level' => $this->input->post('bo_upload_level'), 'bo_download_level' => $this->input->post('bo_download_level'), 'bo_count_modify' => $this->input->post('bo_count_modify'), 'bo_count_delete' => $this->input->post('bo_count_delete'), 'bo_use_private' => $this->input->post('bo_use_private'), 'bo_use_rss' => $this->input->post('bo_use_rss'), 'bo_use_sns' => $this->input->post('bo_use_sns'), 'bo_use_category' => $this->input->post('bo_use_category'), 'bo_use_comment' => $this->input->post('bo_use_comment'), 'bo_use_sideview' => $this->input->post('bo_use_sideview'), 'bo_use_secret' => $this->input->post('bo_use_secret'), 'bo_use_editor' => $this->input->post('bo_use_editor'), 'bo_use_name' => $this->input->post('bo_use_name'), 'bo_use_ip_view' => $this->input->post('bo_use_ip_view'), 'bo_use_list_view' => $this->input->post('bo_use_list_view'), 'bo_use_email' => $this->input->post('bo_use_email'), 'bo_use_syntax' => $this->input->post('bo_use_syntax'), 'bo_subject_len' => $this->input->post('bo_subject_len'), 'bo_page_rows' => $this->input->post('bo_page_rows'), 'bo_page_rows_comt' => $this->input->post('bo_page_rows_comt'), 'bo_new' => $this->input->post('bo_new'), 'bo_hot' => $this->input->post('bo_hot'), 'bo_image_width' => $this->input->post('bo_image_width'), 'bo_reply_order' => $this->input->post('bo_reply_order'), 'bo_sort_field' => $this->input->post('bo_sort_field'), 'bo_insert_content' => $this->input->post('bo_insert_content'), 'bo_use_search' => $this->input->post('bo_use_search')), array('bo_table' => $bo_table));
         alert_close('게시판 설정이 변경되었습니다.');
     }
 }
Example #2
0
 function form($w = '', $mb_id = '')
 {
     $this->load->config('cf_register');
     $this->load->config('cf_icon');
     $this->load->model('Register_model');
     $this->load->library('form_validation');
     $this->load->helper(array('admin', 'chkstr'));
     $config = array(array('field' => 'mb_name', 'label' => '이름', 'rules' => 'trim|required|max_length[10]'), array('field' => 'mb_email', 'label' => '이메일', 'rules' => 'trim|required|max_length[50]|valid_email|callback_mb_email_check'), array('field' => 'mb_sex', 'label' => '성별', 'rules' => 'trim|exact_length[1]'), array('field' => 'mb_birth', 'label' => '생일', 'rules' => 'trim|exact_length[10]'));
     $pwd_req = '';
     if (!$this->input->post('w')) {
         $config[] = array('field' => 'mb_id', 'label' => '아이디', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean|callback_mb_id_check');
         $pwd_req = 'required|';
     }
     $config[] = array('field' => 'mb_password', 'label' => '비밀번호', 'rules' => 'trim|' . $pwd_req . 'min_length[3]|max_length[20]|md5');
     if ($this->config->item('cf_use_nick')) {
         $config[] = array('field' => 'mb_nick', 'label' => '별명', 'rules' => 'trim|required|max_length[20]|callback_mb_nick_check');
     }
     $this->form_validation->set_rules($config);
     if ($this->form_validation->run() == FALSE) {
         $data = array();
         if ($w == '') {
             $mb = array_false(unserialize(MEMBER), TRUE);
             $mb['mb_zip1'] = $mb['mb_zip2'] = '';
             $mb['mb_mailling'] = 1;
             $mb['mb_open'] = 1;
             $mb['mb_level'] = $this->config->item('cf_register_level');
             $title = '등록';
         } else {
             if ($w == 'u') {
                 $mb = $this->Basic_model->get_member($mb_id);
                 if (!isset($mb['mb_id'])) {
                     alert('존재하지 않는 회원자료입니다.');
                 }
                 list($mb['mb_zip1'], $mb['mb_zip2']) = explode('-', $mb['mb_zip']);
                 if ($this->config->item('cf_use_point')) {
                     $mb['mb_point'] = number_format($mb['mb_point']);
                 }
                 if ($this->config->item('cf_use_email_certify')) {
                     $data['passive_certify'] = FALSE;
                     if ($mb['mb_email_certify'] == '0000-00-00 00:00:00') {
                         $data['passive_certify'] = "<input type='checkbox' name='passive_certify'> 수동인증";
                     }
                 }
                 $data['use_email_certify'] = $this->config->item('cf_use_email_certify');
                 $title = '수정';
             } else {
                 alert('잘못된 접근입니다.');
             }
         }
         if ($this->config->item('cf_use_icon')) {
             $mb_path = '/member/' . substr($mb['mb_id'], 0, 2) . '/';
             $icon_path = $mb_path . $mb['mb_id'] . '.gif';
             $icon_file = DATA_DIR . $icon_path;
             if (!file_exists(DATA_PATH . $icon_path)) {
                 $icon_file = FALSE;
             }
             $data['icon_file'] = $icon_file;
             $data['icon_width'] = $this->config->item('cf_icon_width');
             $data['icon_height'] = $this->config->item('cf_icon_height');
             $data['icon_size'] = $this->config->item('cf_icon_size');
             $named_path = $mb_path . 'n_' . $mb['mb_id'] . '.gif';
             $named_file = DATA_DIR . $named_path;
             if (!file_exists(DATA_PATH . $named_path)) {
                 $named_file = FALSE;
             }
             $data['named_file'] = $named_file;
             $data['named_width'] = $this->config->item('cf_named_width');
             $data['named_height'] = $this->config->item('cf_named_height');
             $data['named_size'] = $this->config->item('cf_named_size');
         }
         $head = array('title' => '회원관리 ' . $title);
         $data = array_merge(array('w' => $w, 'token' => get_token(), 'cf_use_nick' => $this->config->item('cf_use_nick'), 'cf_use_icon' => $w ? $this->config->item('cf_use_icon') : FALSE, 'mailling_chk' => $mb['mb_mailling'] ? "checked='checked'" : FALSE, 'open_chk' => $mb['mb_open'] ? "checked='checked'" : FALSE, 'mb_level_select' => get_mb_level_select('mb_level', $mb['mb_level'])), $data, $mb);
         widget::run('head', $head);
         $this->load->view(ADM_F . '/member_form', $data);
         widget::run('tail');
     } else {
         check_token();
         $w = $this->input->post('w');
         $mb_id = $this->input->post('mb_id');
         if ($mb_id == ADMIN) {
             $member = unserialize(MEMBER);
             if ($member['mb_id'] != $mb_id) {
                 alert('최고관리자는 수정할 수 없습니다.');
             }
         }
         if (!$w) {
             $mb = $this->Basic_model->get_member($mb_id, 'mb_id,mb_name,mb_nick,mb_email');
             if (isset($mb['mb_id'])) {
                 alert("이미 존재하는 회원입니다.\\n\\nID : " . $mb['mb_id'] . "\\n\\n이름 : " . $mb['mb_name'] . "\\n\\n별명 : " . $mb['mb_nick'] . "\\n\\n메일 : " . $mb['mb_email']);
             }
             $this->Member_model->insert();
         } else {
             if ($w == 'u') {
                 $mb = $this->Basic_model->get_member($mb_id, 'mb_id');
                 if (!isset($mb['mb_id'])) {
                     alert('존재하지 않는 회원자료입니다.');
                 }
                 $mb_dir = DATA_PATH . '/member/' . substr($mb_id, 0, 2);
                 $mb_icon = $mb_dir . '/' . $mb_id . '.gif';
                 $mb_named = $mb_dir . '/n_' . $mb_id . '.gif';
                 // 아이콘 삭제
                 if ($this->input->post('del_mb_icon')) {
                     @unlink($mb_icon);
                 }
                 // 이미지이름 삭제
                 if ($this->input->post('del_mb_named')) {
                     @unlink($mb_named);
                 }
                 if ($_FILES) {
                     $this->load->library('upload');
                     if (is_uploaded_file($_FILES['mb_icon']['tmp_name'])) {
                         @mkdir($mb_dir, 0707);
                         @chmod($mb_dir, 0707);
                         $config['upload_path'] = $mb_dir;
                         $config['allowed_types'] = 'gif';
                         $config['max_size'] = $this->config->item('cf_icon_size');
                         $config['max_width'] = $this->config->item('cf_icon_width');
                         $config['max_height'] = $this->config->item('cf_icon_height');
                         $config['overwrite'] = TRUE;
                         $config['file_name'] = $mb_id . '.gif';
                         $this->upload->initialize($config);
                         if ($this->upload->do_upload('mb_icon')) {
                             chmod($mb_icon, 0606);
                         }
                     }
                     if (is_uploaded_file($_FILES['mb_named']['tmp_name'])) {
                         @mkdir($mb_dir, 0707);
                         @chmod($mb_dir, 0707);
                         $config['upload_path'] = $mb_dir;
                         $config['allowed_types'] = 'gif';
                         $config['max_size'] = $this->config->item('cf_named_size');
                         $config['max_width'] = $this->config->item('cf_named_width');
                         $config['max_height'] = $this->config->item('cf_named_height');
                         $config['overwrite'] = TRUE;
                         $config['file_name'] = 'n_' . $mb_id . '.gif';
                         $this->upload->initialize($config);
                         if ($this->upload->do_upload('mb_named')) {
                             chmod($mb_named, 0606);
                         }
                     }
                 }
                 $this->Member_model->update();
             } else {
                 alert('잘못된 접근입니다.');
             }
         }
         goto_url(ADM_F . '/member/form/u/' . $mb_id);
     }
 }
Example #3
0
 function select_form($ma_id = '')
 {
     if (!$this->config->item('cf_use_email')) {
         alert("환경설정에서 \\'메일발송 사용\\'에 체크하셔야 메일을 발송할 수 있습니다.");
     }
     $ma = $this->Mail_model->get_mail($ma_id, 'ma_id,ma_last_option');
     if (!isset($ma['ma_id'])) {
         alert('보내실 내용을 선택하여 주십시오.');
     }
     $result = $this->Mail_model->member_cnt();
     $ma_lopt = array();
     $last_option = explode('||', $ma['ma_last_option']);
     foreach ($last_option as $row) {
         $option = explode('=', $row);
         $var = $option[0];
         ${$var} = isset($option[1]) ? $option[1] : '';
     }
     $this->load->helper('admin');
     $head = array('title' => '회원메일발송');
     $data = array('token' => get_token(), 'ma_id' => $ma_id, 'mb_level_from' => get_mb_level_select('mb_level_from', isset($mb_level_from) ? $mb_level_from : 1), 'mb_level_to' => get_mb_level_select('mb_level_to', isset($mb_level_to) ? $mb_level_to : 10), 'mb_mailling' => isset($mb_mailling) ? $mb_mailling : 1, 'mb_area' => isset($mb_area) ? $mb_area : '', 'mb_birth_from' => isset($mb_birth_from) ? $mb_birth_from : '', 'mb_birth_to' => isset($mb_birth_to) ? $mb_birth_to : '', 'mb_email' => isset($mb_email) ? $mb_email : '', 'total_cnt' => number_format($result['total_cnt']), 'leave_cnt' => number_format($result['leave_cnt']), 'member_cnt' => number_format($result['member_cnt']));
     widget::run('head', $head);
     $this->load->view(ADM_F . '/mail_select_form', $data);
     widget::run('tail');
 }
Example #4
0
 function form($w = '', $bo_table = '')
 {
     $this->load->library('form_validation');
     $config = array(array('field' => 'bo_table', 'label' => 'TABLE', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean'), array('field' => 'gr_id', 'label' => '게시판 그룹', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash'), array('field' => 'bo_subject', 'label' => '게시판 제목', 'rules' => 'trim|required|max_length[20]'), array('field' => 'bo_admin', 'label' => '게시판 관리자', 'rules' => 'trim|min_length[3]|max_length[20]|alpha_dash'));
     $this->form_validation->set_rules($config);
     if ($this->form_validation->run() == FALSE) {
         if (!$this->Board_model->is_group()) {
             alert('게시판그룹이 한개 이상 생성되어야 합니다.', ADM_F . '/boardgroup/form');
         }
         if ($w == '' || $w != 'u') {
             $title = '생성';
             $board = array_false(array('bo_table', 'bo_subject', 'bo_admin', 'bo_head', 'bo_tail', 'bo_sort_field', 'bo_insert_content', 'bo_use_private', 'bo_use_rss', 'bo_use_sns', 'bo_use_category', 'bo_use_name', 'bo_use_ip_view', 'bo_use_list_view', 'bo_use_email', 'bo_use_extra', 'bo_use_syntax', 'bo_order_search'));
             $board['bo_count_delete'] = 0;
             $board['bo_count_modify'] = 0;
             $board['bo_use_secret'] = 0;
             $board['bo_page_rows'] = 15;
             $board['bo_page_rows_comt'] = 50;
             $board['bo_subject_len'] = 75;
             $board['bo_new'] = 24;
             $board['bo_hot'] = 100;
             $board['bo_image_width'] = 800;
             $board['bo_upload_ext'] = 'zip|swf';
             $board['bo_upload_size'] = 2048;
             $board['bo_reply_order'] = 1;
             $board['bo_use_comment'] = 1;
             $board['bo_use_sideview'] = 1;
             $board['bo_use_editor'] = 1;
             $board['bo_use_search'] = 1;
             $board['bo_skin'] = 'basic';
             $board['gr_id'] = $w;
         } else {
             if ($w == 'u') {
                 $title = '수정';
                 $board = $this->Basic_model->get_board($bo_table);
                 if (!isset($board['bo_table'])) {
                     alert('존재하지 않은 게시판 입니다.');
                 }
             }
         }
         $upload_max_size = ini_get('upload_max_filesize');
         if (!preg_match("/([m|M])\$/", $upload_max_size)) {
             $upload_max_size = (int) ($upload_max_size / 1048576);
         }
         $head = array('title' => '게시판' . $title);
         $data = array('w' => $w, 'token' => get_token(), 'bo_table' => $board['bo_table'], 'bo_subject' => $board['bo_subject'], 'bo_admin' => $board['bo_admin'], 'bo_head' => $board['bo_head'], 'bo_tail' => $board['bo_tail'], 'bo_insert_content' => $board['bo_insert_content'], 'bo_order_search' => $board['bo_order_search'], 'bo_sort_field' => $board['bo_sort_field'], 'bo_count_write' => isset($board['bo_count_write']) ? number_format($board['bo_count_write']) : FALSE, 'bo_count_comment' => isset($board['bo_count_comment']) ? number_format($board['bo_count_comment']) : FALSE, 'upload_max_size' => $upload_max_size, 'bo_skin' => $board['bo_skin'], 'gr_id' => $board['gr_id'], 'bo_count_delete' => $board['bo_count_delete'], 'bo_count_modify' => $board['bo_count_modify'], 'bo_use_secret' => $board['bo_use_secret'], 'bo_page_rows' => $board['bo_page_rows'], 'bo_page_rows_comt' => $board['bo_page_rows_comt'], 'bo_subject_len' => $board['bo_subject_len'], 'bo_new' => $board['bo_new'], 'bo_hot' => $board['bo_hot'], 'bo_image_width' => $board['bo_image_width'], 'bo_upload_ext' => $board['bo_upload_ext'], 'bo_upload_size' => $board['bo_upload_size'], 'bo_reply_order' => $board['bo_reply_order'], 'use_private_chk' => $board['bo_use_private'] ? "checked='checked'" : '', 'use_rss_chk' => $board['bo_use_rss'] ? "checked='checked'" : '', 'use_sns_chk' => $board['bo_use_sns'] ? "checked='checked'" : '', 'use_comment_chk' => $board['bo_use_comment'] ? "checked='checked'" : '', 'use_category_chk' => $board['bo_use_category'] ? "checked='checked'" : '', 'use_sideview_chk' => $board['bo_use_sideview'] ? "checked='checked'" : '', 'use_editor_chk' => $board['bo_use_editor'] ? "checked='checked'" : '', 'use_name_chk' => $board['bo_use_name'] ? "checked='checked'" : '', 'use_ip_view_chk' => $board['bo_use_ip_view'] ? "checked='checked'" : '', 'use_list_view_chk' => $board['bo_use_list_view'] ? "checked='checked'" : '', 'use_email_chk' => $board['bo_use_email'] ? "checked='checked'" : '', 'use_extra_chk' => $board['bo_use_extra'] ? "checked='checked'" : '', 'use_syntax_chk' => $board['bo_use_syntax'] ? "checked='checked'" : '', 'use_search_chk' => $board['bo_use_search'] ? "checked='checked'" : '', 'group_select' => get_group_select('gr_id', $board['gr_id']), 'skin_select' => get_skin_dir('board', 'bo_skin', $board['bo_skin']), 'bo_list_level' => get_mb_level_select('bo_list_level', isset($board['bo_list_level']) ? $board['bo_list_level'] : 1), 'bo_read_level' => get_mb_level_select('bo_read_level', isset($board['bo_read_level']) ? $board['bo_read_level'] : 1), 'bo_write_level' => get_mb_level_select('bo_write_level', isset($board['bo_write_level']) ? $board['bo_write_level'] : 2), 'bo_reply_level' => get_mb_level_select('bo_reply_level', isset($board['bo_reply_level']) ? $board['bo_reply_level'] : 2), 'bo_comment_level' => get_mb_level_select('bo_comment_level', isset($board['bo_comment_level']) ? $board['bo_comment_level'] : 2), 'bo_upload_level' => get_mb_level_select('bo_upload_level', isset($board['bo_upload_level']) ? $board['bo_upload_level'] : 2), 'bo_download_level' => get_mb_level_select('bo_download_level', isset($board['bo_download_level']) ? $board['bo_download_level'] : 2));
         widget::run('head', $head);
         $this->load->view(ADM_F . '/board_form', $data);
         widget::run('tail');
     } else {
         check_token();
         $w = $this->input->post('w');
         $bo_table = $this->input->post('bo_table');
         if (!$w) {
             $bo = $this->Basic_model->get_board($bo_table, 'bo_table');
             if (isset($bo['bo_table'])) {
                 alert($bo['bo_table'] . '은(는) 이미 존재하는 TABLE 입니다.');
             }
             $board_path = DATA_PATH . '/file/' . $bo_table;
             // 게시판 디렉토리 생성
             mkdir($board_path, 0707);
             chmod($board_path, 0707);
             // 게시판 썸네일 디렉토리 생성
             mkdir($board_path . '/thumb', 0707);
             chmod($board_path . '/thumb', 0707);
             $this->load->helper('file');
             $board_index = $board_path . '/index.html';
             write_file($board_index, '');
             chmod($board_index, 0606);
             $this->Board_model->insert();
         } else {
             if ($w == 'u') {
                 // 글수 조정
                 if ($this->input->post('proc_count')) {
                     $this->Board_model->proc_count();
                 }
                 // 공지 가져오기
                 $is_notice = '';
                 $bo = $this->Basic_model->get_board($bo_table, 'bo_notice');
                 if (isset($bo['bo_notice'])) {
                     $is_notice = $bo['bo_notice'];
                 }
                 $this->Board_model->update($is_notice);
             } else {
                 alert('잘못된 접근입니다.');
             }
         }
         if ($this->input->post('chk')) {
             $this->Board_model->group_update();
         }
         goto_url(ADM_F . '/board/form/u/' . $bo_table);
     }
 }