function lists() { $param =& $this->querystring; $page = $this->uri->segment(5, 1); $sfl = $param->get('sfl'); $stx = $param->get('stx'); $fr_date = $param->get('from', TIME_YMD); $to_date = $param->get('to', TIME_YMD); $config['suffix'] = $param->output(); $config['base_url'] = RT_PATH . '/' . ADM_F . '/visit/lists/page/'; $config['per_page'] = 15; $offset = ($page - 1) * $config['per_page']; $result = $this->Visit_model->list_result($fr_date, $to_date, $config['per_page'], $offset); $config['total_rows'] = $result['total_cnt']; $this->pagination->initialize($config); $list = array(); foreach ($result['qry'] as $i => $row) { $parse = parse_url($row['vi_referer']); $host = isset($parse['host']) ? $parse['host'] : ''; $list[$i] = new stdClass(); $list[$i]->vi_ip = $row['vi_ip']; $list[$i]->vi_date = $row['vi_date']; $list[$i]->vi_time = $row['vi_time']; $list[$i]->vi_referer = $row['vi_referer']; $list[$i]->vi_agent = $row['vi_agent']; $list[$i]->path = $host . $parse['path']; } $head = array('title' => '방문자분석'); $data = array('list' => $list, 'fr_date' => $fr_date, 'to_date' => $to_date, 'paging' => $this->pagination->create_links()); widget::run('head', $head); $this->load->view(ADM_F . '/visit', $data); widget::run('tail'); }
function index() { $member = unserialize(MEMBER); if (!$member['mb_email']) { alert('관리자 E-mail이 존재하지 않습니다.'); } $mail_addr = $mail_msg = FALSE; if ($this->input->post('mail_addr')) { check_token(); $mail_addr = $this->input->post('mail_addr'); $subject = '[메일검사] 제목'; $content = '[메일검사] 내용<br />이 내용이 제대로 보인다면 보내는 메일 서버에는 이상이 없는것입니다.<br />발송시간 : ' . date('Y-m-d H:i:s') . '<br />이 메일 주소로는 회신되지 않습니다.'; $this->email->clear(); $this->email->from($member['mb_email'], '메일검사'); $this->email->to($mail_addr); $this->email->subject($subject); $this->email->message($content); if (!$this->email->send()) { $mail_msg = '<strong>※ 메일전송 오류</strong><br/>' . $this->email->print_debugger(); } else { $mail_msg = '<strong>' . $mail_addr . '</strong> (으)로 메일을 발송 하였습니다. <br/>해당 주소로 메일이 왔는지 확인하세요. <br/>메일이 오지 않는다면 프로그램의 오류가 아닌 <br/>메일 서버(sendmail)의 오류일 가능성이 있습니다. <br/>이런 경우에는 웹 서버관리자에게 문의하세요.'; } } $head = array('title' => '메일전송 테스트'); $data = array('token' => get_token(), 'mail_addr' => $mail_addr, 'mail_msg' => $mail_msg); widget::run('head', $head); $this->load->view(ADM_F . '/sendmail_test', $data); widget::run('tail'); }
function index() { $member =& $this->member; $board =& $this->board; $seg =& $this->seg; $type = $seg->get('type'); switch ($type) { case 'image': $title = '이미지'; break; case 'file': $title = '파일'; break; case 'media': $title = '멀티미디어'; break; default: alert_close('잘못된 접근입니다.'); break; } if ($member['mb_level'] < $board['bo_upload_level']) { alert_close('업로드 권한이 없습니다.'); } $head = array('title' => $title . ' 첨부'); $data = array('upload_size' => $board['bo_upload_size'], 'upload_ext' => '*.' . str_replace('|', ';*.', $board['bo_upload_ext'])); widget::run('head', $head); $this->load->view('board/editor_' . $type, $data); widget::run('tail'); }
function step3() { check_wrkey(); $this->session->set_flashdata('mb_idpwd', $this->input->post('mb_id')); $mb = $this->Basic_model->get_member($this->input->post('mb_id'), 'mb_id, mb_password_a'); if (!isset($mb['mb_id'])) { alert('존재하지 않는 회원입니다.', '/'); } else { if ($mb['mb_id'] == ADMIN) { alert('관리자 아이디는 접근 불가합니다.', '/'); } else { if ($this->input->post('mb_password_a') !== $mb['mb_password_a']) { alert('비밀번호 분실시 답변이 틀립니다.'); } } } // 난수 발생 list($usec, $sec) = explode(' ', microtime()); $seed = (double) $sec + (double) $usec * 100000; srand($seed); $change_pwd = substr(md5($seed), 0, rand(4, 6)); $this->Member_forget_model->new_pwd($change_pwd); $head = array('title' => '비밀번호 찾기 결과'); $data = array('mb_id' => $mb['mb_id'], 'change_pwd' => $change_pwd); widget::run('head', $head); $this->load->view('member/forget_pwd2', $data); widget::run('tail'); }
function qry($mb_id) { if (!IS_MEMBER) { alert_close("회원만 이용하실 수 있습니다."); } $member = unserialize(MEMBER); if (!$member['mb_open'] && !SU_ADMIN && $member['mb_id'] != $mb_id) { alert_close("자신의 정보를 공개하지 않으면 다른분의 정보를 조회할 수 없습니다.\\n\\n정보공개 설정은 회원정보수정에서 하실 수 있습니다."); } $mb = $this->Basic_model->get_member($mb_id, "mb_id, mb_level, mb_point, mb_homepage, mb_open, mb_nick, mb_datetime, mb_today_login, mb_profile"); if (!isset($mb['mb_id'])) { alert_close("회원정보가 존재하지 않습니다.\\n\\n탈퇴하였을 수 있습니다."); } if (!$mb['mb_open'] && !SU_ADMIN && $member['mb_id'] != $mb_id) { alert_close("정보공개를 하지 않았습니다."); } $name = $this->config->item('cf_use_nick') && $mb['mb_nick'] ? $mb['mb_nick'] : $mb['mb_name']; $name = get_sideview($mb['mb_id'], $name); // 회원가입후 몇일째인지? + 1 은 당일을 포함한다는 뜻 $query = $this->db->query("select (TO_DAYS('" . TIME_YMDHIS . "') - TO_DAYS('" . $mb['mb_datetime'] . "') + 1) as days"); $row = $query->row_array(); $mb_reg_after = $row['days']; $mb_homepage = prep_url($mb['mb_homepage']); $mb_profile = $mb['mb_profile'] ? conv_content($mb['mb_profile'], FALSE) : "소개 내용이 없습니다."; $mb_join_date = $member['mb_level'] >= $mb['mb_level'] ? substr($mb['mb_datetime'], 0, 10) . " (" . $mb_reg_after . " 일)" : "알 수 없음"; $mb_last_login = $member['mb_level'] >= $mb['mb_level'] ? $mb['mb_today_login'] : "******"; $head = array('title' => $mb['mb_nick'] . "님의 자기소개"); $data = array('name' => $name, 'profile' => $mb_profile, 'homepage' => $mb_homepage, 'point' => number_format($mb['mb_point']), 'join_date' => $mb_join_date, 'last_login' => $mb_last_login); widget::run('head', $head); $this->load->view('member/profile', $data); widget::run('tail'); }
function index() { if (SU_ADMIN != ADMIN) { alert('최고관리자만 접근할 수 있습니다.'); return false; } function get_cf_custom($file) { $str = str_replace(array('<?', '?>', '\'', '"'), '', file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/app/config/cf_' . $file . '.php')); preg_match_all("/config\\[(.*)\\]\\s+=\\s+(.*);\\s+\\/\\/(.*)/", $str, $match); $list = array(); foreach ($match[1] as $i => $v) { $list[$i] = new stdClass(); $list[$i]->title = $v; $list[$i]->value = $match[2][$i]; $list[$i]->comment = $match[3][$i]; } return $list; } $head = array('title' => '환경설정'); $data = array('basic' => get_cf_custom('basic'), 'board' => get_cf_custom('board'), 'icon' => get_cf_custom('icon'), 'register' => get_cf_custom('register')); widget::run('head', $head); $this->load->view(ADM_F . '/config', $data); widget::run('tail'); }
function index() { $seg =& $this->seg; $w = $seg->get('w'); // 모드 $wr_id = $seg->get('wr_id'); // 게시물아이디 $comment_id = $seg->get('comment_id'); // 코멘트아이디 $qstr = $seg->output(); switch ($w) { case 'u': $action = 'board/' . BO_TABLE . '/write' . $qstr; break; case 'd': $qstr = $seg->replace('wr_id', '', $qstr); $action = '_trans/board_write/delete'; break; case 'x': $action = '_trans/board_comment/delete'; break; case 's': if (IS_ADMIN) { // 관리자 통과 goto_url('board/' . BO_TABLE . '/view/wr_id/' . $wr_id); } $write = $this->Basic_model->get_write(BO_TABLE, $wr_id, 'mb_id'); // 회원의 글이라면 if ($write['mb_id']) { $member =& $this->member; if (IS_MEMBER && $member['mb_id'] == $write['mb_id']) { // 자신의 글 goto_url('board/' . BO_TABLE . '/view/wr_id/' . $wr_id); } else { $msg = '글을 읽을 권한이 없습니다.'; if (!IS_MEMBER) { $msg .= '\\n\\n답글의 경우 비회원은 본인글을 읽은 후 읽어 주시기 바랍니다.'; } alert($msg); } } else { // 비회원 $action = '_trans/board_password/check'; } break; default: alert('잘못된 접근입니다.'); break; } $head = array('title' => '비밀번호 확인'); $data = array('w' => $w, 'wr_id' => $wr_id, 'comment_id' => $comment_id, 'action' => $action, 'qstr' => $seg->replace('w,comment_id', '', $qstr)); widget::run('head', $head); $this->load->view('board/password', $data); widget::run('tail'); }
function index() { // $this->output->cache(1440); // 캐시 되고 있는동안 common 작동 안함 // 계정의 사용량을 구함 $account_space = `du -sb`; $account_space = substr($account_space, 0, strlen($account_space) - 3); // DATA 폴더의 용량을 구함 $data_path = DATA_PATH; $data_space = `du -sb {$data_path}`; $data_space = substr($data_space, 0, strlen($data_space) - 8); // GD 버젼 $gd_support = extension_loaded('gd'); if ($gd_support) { $gd_info = gd_info(); $gd_version = $gd_info['GD Version']; } else { $gd_version = 'GD가 설치되지 않음'; } // MySQL 버전 $query = $this->db->query('select version() as ver'); $row = $query->row_array(); $db_version = $row['ver']; /* // http://kr2.php.net/manual/kr/function.mysql-stat.php $mysql_stat = explode(' ', mysql_stat()); $a = explode(':', $mysql_stat[0]); $db_date = $a[0] . ': '; $days = floor($a[1]/86400); if ($days) $db_date .= $days . '일 '; $hours = (floor($a[1]/3600)%24); if ($hours) $db_date .= $hours . '시간 '; $min = (floor($a[1]/60)%60); if ($min) $db_date .= $min . '분'; $t = explode(':', $mysql_stat[2]); $db_status = $mysql_stat[1].'<br/>'; $db_status .= $t[0].': '.number_format($t[1]).'<br/>'; $db_status .= $mysql_stat[3].'<br/>'; $db_status .= $mysql_stat[4].'<br/>'; $db_status .= $mysql_stat[5].'<br/>'; $db_status .= $mysql_stat[6].'<br/>'; $db_status .= $mysql_stat[7].'<br/>'; */ $head = array('title' => '관리자 페이지'); $data = array('os_version' => php_uname('r'), 'ip_addr' => gethostbyname(trim(`hostname`)), 'account_space' => byte_format($account_space), 'data_space' => byte_format($data_space), 'code_space' => byte_format($account_space - $data_space), 'php_version' => phpversion(), 'zend_version' => zend_version(), 'gd_version' => $gd_version, 'max_filesize' => get_cfg_var('upload_max_filesize'), 'db_version' => $db_version, 'db_date' => '', 'db_status' => ''); widget::run('head', $head); $this->load->view(ADM_F . '/main', $data); widget::run('tail'); }
function qry($aurl) { if (!IS_MEMBER) { alert('로그인 한 회원만 접근하실 수 있습니다.', '/'); } $member = unserialize(MEMBER); $this->session->unset_userdata('ss_tmp_password'); $head = array('title' => '회원 비밀번호 확인'); $data = array('token' => get_token(), 'mb_id' => $member['mb_id'], 'action' => RT_PATH . '/' . str_replace('.', '/', $aurl)); widget::run('head', $head); $this->load->view('member/confirm', $data); widget::run('tail'); }
function _remap($pu_id) { $pu = $this->Popup_model->get($pu_id, 'pu_id, pu_name, pu_file'); if (!isset($pu['pu_id'])) { alert_close('등록된 팝업이 아닙니다.'); } if (SU_ADMIN && !file_exists(SKIN_PATH . 'popup/' . $pu['pu_file'] . '.html')) { alert_close('팝업 파일이 없습니다.'); } $head = array('title' => $pu['pu_name']); $data = array('id' => 'popup' . $pu_id); widget::run('head', $head); $this->load->view('popup/' . $pu['pu_file'], $data); widget::run('tail'); }
function qry($msg = FALSE) { if (IS_MEMBER) { goto_url(URL); } if ($this->input->post('url')) { $url = $this->input->post('url'); } else { $url = is_numeric($msg) ? URL : urldecode(str_replace('.', '%', $msg)); } $reId = get_cookie('ck_mb_id'); $head = array('title' => '로그인'); $data = array('url' => $url, 'msg' => $msg == 1 ? TRUE : FALSE, 'reId' => $reId, 'chk_reId' => $reId ? 1 : 0); widget::run('head', $head); $this->load->view('member/login', $data); widget::run('tail'); }
function form($w = '', $gr_id = '') { $this->load->library('form_validation'); $config = array(array('field' => 'gr_id', 'label' => '아이디', 'rules' => 'trim|required|min_length[3]|max_length[20]|alpha_dash|xss_clean'), array('field' => 'gr_subject', 'label' => '제목', 'rules' => 'trim|required|max_length[20]'), array('field' => 'gr_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 ($w == '') { $title = '생성'; $gr = FALSE; } else { if ($w == 'u') { $gr = $this->Boardgroup_model->get_group($gr_id); if (!isset($gr['gr_id'])) { alert('존재하지 않는 그룹 ID 입니다.'); } $title = '수정'; } else { alert('잘못된 접근입니다.'); } } $head = array('title' => '게시판그룹' . $title); $data = array('w' => $w, 'token' => get_token(), 'gr_id' => $gr['gr_id'], 'gr_subject' => $gr['gr_subject'], 'gr_admin' => $gr['gr_admin']); widget::run('head', $head); $this->load->view(ADM_F . '/boardgroup_form', $data); widget::run('tail'); } else { check_token(); $w = $this->input->post('w'); $gr_id = $this->input->post('gr_id'); if (!$w) { $gr = $this->Boardgroup_model->get_group($gr_id); if (isset($gr['gr_id'])) { alert("이미 존재하는 그룹 ID 입니다."); } $this->Boardgroup_model->insert(); } else { if ($w == 'u') { $this->Boardgroup_model->update(); } else { alert('잘못된 접근입니다.'); } } // goto_url(ADM_F.'/boardgroup/form/u/'.$gr_id); goto_url(ADM_F . '/boardgroup/lists'); } }
function index() { $bo_table = $this->input->post('bo_table'); $wr_id = $this->input->post('wr_id'); $sw = $this->input->post('sw'); $board = $this->Basic_model->get_board($bo_table, 'bo_admin', TRUE); $member = unserialize(MEMBER); define('IS_ADMIN', is_admin($member, $board)); // 게시판 관리자 이상 복사, 이동 가능 if (!IS_ADMIN) { show_404(); } if (!$wr_id) { alert_close('잘못된 접근입니다.'); } switch ($sw) { case 'move': $act = '이동'; break; case 'copy': $act = '복사'; break; default: alert_close('잘못된 접근입니다.'); break; } $result = $this->Board_mvcp_model->list_move_copy($bo_table, $member['mb_id']); $list = array(); $save_gr_subject = ''; foreach ($result as $i => $row) { $list[$i] = new stdClass(); $list[$i]->bo_table = $row['bo_table']; $span = $save_gr_subject == $row['gr_subject'] ? "<span style='color:#cccccc;'>" : '<span>'; $list[$i]->gr_subject = $span . $row['gr_subject'] . ' > </span>'; $list[$i]->bo_subject = $row['bo_subject']; $save_gr_subject = $row['gr_subject']; } $head = array('title' => '게시물 ' . $act); $data = array('sw' => $sw, 'bo_table' => $bo_table, 'wr_id' => serialize($wr_id), 'act' => $act, 'list' => $list); widget::run('head', $head); $this->load->view('board/movecopy', $data); widget::run('tail'); }
function page($page = 1) { if (!IS_MEMBER) { alert('회원만 조회하실 수 있습니다.'); } $member = unserialize(MEMBER); $config['base_url'] = RT_PATH . '/member/point/page/'; $config['total_rows'] = $this->Member_point_model->total_cnt($member['mb_id']); $config['per_page'] = 15; $config['uri_segment'] = 4; $this->pagination->initialize($config); $offset = ($page - 1) * $config['per_page']; $result = $this->Member_point_model->list_result($member['mb_id'], $config['per_page'], $offset); $list = array(); $sum_point1 = $sum_point2 = FALSE; foreach ($result as $i => $row) { $point1 = $point2 = 0; if ($row['po_point'] > 0) { $point1 = "+" . number_format($row['po_point']); $sum_point1 += $row['po_point']; } else { $point2 = number_format($row['po_point']); $sum_point2 += $row['po_point']; } $list[$i] = new stdClass(); $list[$i]->po_content = $row['po_content']; $list[$i]->po_datetime = substr($row['po_datetime'], 2, 8); $list[$i]->point1 = $point1; $list[$i]->point2 = $point2; } if ($config['total_rows']) { if ($sum_point1 > 0) { $sum_point1 = '+' . number_format($sum_point1); } $sum_point2 = number_format($sum_point2); } $head = array('title' => $member['mb_nick'] . ' 님의 포인트 내역'); $data = array('paging' => $this->pagination->create_links(), 'mb_point' => number_format($member['mb_point']), 'list' => $list, 'sum_point1' => $sum_point1, 'sum_point2' => $sum_point2); widget::run('head', $head); $this->load->view('member/point', $data); widget::run('tail'); }
function qry($form, $fzip1, $fzip2, $faddr1, $faddr2) { // 메모리를 많이 잡아먹어서 아래의 코드로 대체 // ini_set('memory_limit', '20M'); // $zipfile = file("./zip.db"); $zipfile = array(); $fp = fopen(SKIN_PATH . "useful/zip.db", "r"); while (!feof($fp)) { $zipfile[] = fgets($fp, 4096); } fclose($fp); $count = 0; $list = array(); $addr1 = FALSE; if ($this->input->post('addr1')) { $addr1 = $this->input->post('addr1'); foreach ($zipfile as $i => $row) { if (strstr(substr($row, 9, 512), $addr1)) { $list[$i] = new stdClass(); $list[$i]->zip1 = substr($row, 0, 3); $list[$i]->zip2 = substr($row, 4, 3); $addr = explode(" ", substr($row, 8)); if ($addr[sizeof($addr) - 1]) { $list[$i]->addr = str_replace($addr[sizeof($addr) - 1], "", substr($row, 8)); $list[$i]->bunji = trim($addr[sizeof($addr) - 1]); } else { $list[$i]->addr = substr($row, 8); } $count++; } } if (!$list) { alert('찾으시는 주소가 없습니다.'); } } $head = array('title' => '우편번호 검색'); $data = array('form' => $form, 'fzip1' => $fzip1, 'fzip2' => $fzip2, 'faddr1' => $faddr1, 'faddr2' => $faddr2, 'search_count' => $count, 'list' => $list, 'addr1' => $addr1); widget::run('head', $head); $this->load->view('useful/zip', $data); widget::run('tail'); }
function index() { $popup = $this->Popup_model->output(); $pubasic = $pulayer = array(); foreach ($popup as $i => $row) { $id = $row['pu_id']; $skin = 'popup/' . $row['pu_file']; if (!$this->input->cookie('popup' . $id) && file_exists(SKIN_PATH . $skin . '.html')) { if ($row['pu_type'] == 1) { $pubasic[] = "<div id='popup" . $id . "' style='position:absolute; width:" . $row['pu_width'] . "px; height:" . $row['pu_height'] . "px; top:" . $row['pu_y'] . "px; left:" . $row['pu_x'] . "px; z-index:100; overflow:hidden;'>" . $this->load->view($skin, array('id' => 'popup' . $id), TRUE) . "</div>"; } else { $pulayer[$i]->id = $id; $pulayer[$i]->html = "win_open('popup/" . $id . "', 'popup" . $id . "', 'left=" . $row['pu_x'] . "px,top=" . $row['pu_y'] . "px,width=" . $row['pu_width'] . "px,height=" . $row['pu_height'] . "px,scrollbars=0');"; } } } $data = array('pubasic' => $pubasic, 'pulayer' => $pulayer, 'write' => $this->Latest_model->write('test', 10, 50), 'comment' => $this->Latest_model->comment(10, 50)); widget::run('head'); $this->load->view('main/main', $data); widget::run('tail'); }
function index() { $this->Repair_model->delete_popular(); $this->Repair_model->delete_memo(); $rep_result = $opt_result = FALSE; $tables = $this->db->list_tables(); foreach ($tables as $table) { // 테이블 수리 if (!$this->dbutil->repair_table($table)) { $rep_result .= $table . ' 실패 <br/>'; } // 테이블 최적화 if (!$this->dbutil->optimize_table($table)) { $opt_result .= $table . ' 실패 <br/>'; } } $head = array('title' => '테이블 복구 및 최적화'); $data = array('rep_result' => $rep_result ? $rep_result : '테이블 수리 완료', 'opt_result' => $opt_result ? $opt_result : '테이블 최적화 완료'); widget::run('head', $head); $this->load->view(ADM_F . '/repair', $data); widget::run('tail'); }
function category() { $bo_table = $this->input->post('bo_table'); if (!IS_MEMBER || !$bo_table) { show_404(); } $bo = $this->Basic_model->get_board($bo_table, 'bo_table,bo_admin,bo_subject'); if (!isset($bo['bo_table'])) { alert_close('존재하지 않는 게시판 입니다.'); } $member = unserialize(MEMBER); if ($member['mb_id'] != $bo['bo_admin']) { show_404(); } define('CSS_SKIN', 'category'); $type = 'bo_' . $bo_table; $this->load->model('Categoryform_model'); $bc = $this->Categoryform_model->list_result($type); $code_html = FALSE; if ($bc) { $t_code = $s_code = array(); foreach ($bc as $row) { $code_exp = explode('-', $row['code']); if (!isset($code_exp[1])) { $t_code[$code_exp[0]] = $row['ca_name']; } else { $s_code[$code_exp[0]][$code_exp[1]] = $row['ca_name']; } } $this->load->helper('categoryform'); $code_html = get_categoryform($t_code, $s_code); } $head = array('title' => $bo['bo_subject']); $data = array('bo_table' => $bo_table, 'type' => $type, 'code_html' => $code_html); widget::run('head', $head); $this->load->view('board/admin_category', $data); widget::run('tail'); }
function lists($type = '', $tid = '') { switch ($type) { case 'board': $bo = $this->Basic_model->get_board($tid, 'bo_table,bo_subject'); if (!isset($bo['bo_table'])) { alert('존재하지 않는 게시판 입니다.'); } $name = $bo['bo_subject']; $type = 'bo_' . $tid; break; default: alert('잘못된 접근입니다.'); break; } $bc = $this->Categoryform_model->list_result($type); $code_html = FALSE; if ($bc) { $t_code = $s_code = array(); foreach ($bc as $row) { $code_exp = explode('-', $row['code']); if (!isset($code_exp[1])) { $t_code[$code_exp[0]] = $row['ca_name']; } else { $s_code[$code_exp[0]][$code_exp[1]] = $row['ca_name']; } } $code_html = get_categoryform($t_code, $s_code); } // echo '<PRE>'; // print_r($s_code); $head = array('title' => $name . ' 분류관리'); $data = array('name' => $name, 'type' => $type, 'tid' => $tid, 'code_html' => $code_html); widget::run('head', $head); $this->load->view(ADM_F . '/category', $data); widget::run('tail'); }
function ex($bo_table = '') { $bo = $this->Basic_model->get_board($bo_table, 'bo_table,bo_subject'); if (!isset($bo['bo_table'])) { alert('존재하지 않는 게시판 입니다.'); } $table_name = 'ki_extra_' . $bo_table; $config = array(array('field' => 'bo_table', 'label' => '아이디', 'rules' => 'trim|required|max_length[20]|alpha_dash'), array('field' => 'type', 'label' => '타입', 'rules' => 'trim|required')); if ($this->input->post('type') == 'field') { $config[] = array('field' => 'name', 'label' => '이름', 'rules' => 'trim|required|max_length[20]|alpha_dash'); $config[] = array('field' => 'attr', 'label' => '속성', 'rules' => 'trim|required|alpha'); $config[] = array('field' => 'size', 'label' => '크기', 'rules' => 'trim|max_length[3]|is_natural'); } $this->form_validation->set_rules($config); if ($this->form_validation->run() == FALSE) { $w = ''; $type = 'field'; $is_table = TRUE; $list = array(); if (!$this->db->table_exists($table_name)) { $is_table = FALSE; $type = 'table'; } else { $qry = $this->db->query('desc ' . $table_name); $result = $qry->result_array(); foreach ($result as $i => $row) { if ($row['Field'] == 'wr_id') { continue; } $list[$i] = new stdClass(); $list[$i]->name = $row['Field']; $list[$i]->attr = $row['Type']; $list[$i]->unsg = FALSE; $list[$i]->size = ''; preg_match('/\\(([0-9]+)\\)/', $row['Type'], $size); if (isset($size[1])) { $attr = str_replace($size[0], '', $row['Type']); if (strpos($attr, 'unsigned') !== FALSE) { $list[$i]->unsg = " selected='selected'"; $attr = str_replace('unsigned', '', $attr); } $list[$i]->size = $size[1]; $list[$i]->attr = trim($attr); } } } $head = array('title' => $bo['bo_subject'] . ' 여분필드 관리'); $data = array('is_table' => $is_table, 'type' => $type, 'w' => $w, 'list' => $list, 'bo_table' => $bo_table, 'bo_subject' => $bo['bo_subject']); widget::run('head', $head); $this->load->view(ADM_F . '/boardextra', $data); widget::run('tail'); } else { $w = $this->input->post('w'); $type = $this->input->post('type'); $this->load->dbforge(); switch ($type) { case 'table': if ($w == '') { $this->dbforge->add_field(array('wr_id' => array('type' => 'int', 'constraint' => 10, 'unsigned' => TRUE))); $this->dbforge->add_key('wr_id', TRUE); $this->dbforge->create_table($table_name, TRUE); } else { if ($w == 'd') { $this->dbforge->drop_table($table_name); } } break; case 'field': $name = $this->input->post('name'); $attr = $this->input->post('attr'); $size = $this->input->post('size'); $unsg = $this->input->post('unsg'); if ($w == '') { $field = array('ex_' . $name => array('type' => $attr, 'null' => FALSE)); if ($size) { $field['ex_' . $name]['constraint'] = $size; } if ($unsg) { $field['ex_' . $name]['unsigned'] = TRUE; } $this->dbforge->add_column($table_name, $field); } else { if ($w == 'u') { $field = array($name => array('name' => $name, 'type' => $attr, 'null' => FALSE)); if ($size) { $field[$name]['constraint'] = $size; } if ($unsg) { $field[$name]['unsigned'] = TRUE; } $this->dbforge->modify_column($table_name, $field); } else { if ($w == 'd') { $this->dbforge->drop_column($table_name, $name); } } } break; } goto_url(ADM_F . '/boardextra/ex/' . $bo_table); } }
function form($w = '', $pu_id = '') { $this->load->library('form_validation'); $config = array(array('field' => 'pu_name', 'label' => '팝업 이름', 'rules' => 'trim|required|max_length[20]|xss_clean'), array('field' => 'pu_file', 'label' => '팝업 파일', 'rules' => 'trim|required|max_length[20]|alpha_dash')); $this->form_validation->set_rules($config); if ($this->form_validation->run() == FALSE) { if ($w == '' || $w != 'u') { $title = '등록'; $pu = array_false(array('pu_id', 'pu_name', 'pu_file')); $s = array_false(array('date', 'h', 'i', 's')); $e = array_false(array('date', 'h', 'i', 's')); $pu['pu_use'] = $pu['pu_type'] = 0; $pu['pu_width'] = $pu['pu_height'] = 100; $pu['pu_x'] = $pu['pu_y'] = 0; } else { if ($w == 'u') { $title = '수정'; $pu = $this->Popup_model->get_popup($pu_id); if (!isset($pu['pu_id'])) { alert('등록된 자료가 없습니다.'); } // 시작일 list($s['date'], $time) = explode(' ', $pu['pu_sdate']); list($s['h'], $s['i'], $s['s']) = explode(':', $time); // 종료일 list($e['date'], $time) = explode(' ', $pu['pu_edate']); list($e['h'], $e['i'], $e['s']) = explode(':', $time); } } $head = array('title' => '팝업 ' . $title); $data = array('w' => $w, 'token' => get_token(), 'id' => $pu['pu_id'], 'name' => $pu['pu_name'], 'file' => $pu['pu_file'], 'use_chk' => $pu['pu_use'] ? "checked='checked'" : '', 'type' => $pu['pu_type'], 'sdate' => $s['date'], 'stime_h' => $s['h'], 'stime_i' => $s['i'], 'stime_s' => $s['s'], 'edate' => $e['date'], 'etime_h' => $e['h'], 'etime_i' => $e['i'], 'etime_s' => $e['s'], 'width' => $pu['pu_width'], 'height' => $pu['pu_height'], 'x' => $pu['pu_x'], 'y' => $pu['pu_y']); widget::run('head', $head); $this->load->view(ADM_F . '/popup_form', $data); widget::run('tail'); } else { check_token(); $w = $this->input->post('w'); if (!$w) { $pu = $this->Popup_model->get_popup($pu_id, 'pu_id'); if (isset($pu['pu_id'])) { alert('이미 존재하는 팝업 ID 입니다.'); } } else { if ($w == 'u') { // what!? } else { alert('잘못된 접근입니다.'); } } $pu_id = $this->Popup_model->record($w); // goto_url(ADM_F.'/popup/form/u/'.$pu_id); goto_url(ADM_F . '/popup/lists'); } }
function index($view = FALSE) { $board =& $this->board; $member =& $this->member; $wr_field =& $this->wr_field; $seg =& $this->seg; $param =& $this->param; $wr_id = $seg->get('wr_id'); // 게시물아이디 $page = $seg->get('page', 1); // 페이지 $qstr = $seg->replace('wr_id') . $param->output(); $sst = $param->get('sst'); // 정렬필드 $sod = $param->get('sod'); // 정렬순서 $sfl = $param->get('sfl'); // 검색필드 $stx = $param->get('stx'); // 검색어 $sca = $param->get('sca'); // 분류 $spt = $param->get('spt'); // 검색 파트 $js = array('board'); // JavaScript Files if ($member['mb_level'] < $board['bo_list_level']) { if (IS_MEMBER) { alert('목록을 볼 권한이 없습니다.'); } else { alert("목록을 볼 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", 'member/login/qry/' . url_encode('board/' . BO_TABLE . '/lists' . $qstr)); } } // 분류 사용 여부 $sca_str = $sca ? '?sca=' . $sca : ''; $category = FALSE; if ($board['bo_use_category']) { $this->load->helper('category'); $category = make_category(array('type' => 'bo_' . BO_TABLE, 'id' => 'ca_code', 'code' => $sca, 'lst' => TRUE)); } // 검색 파트 row $search_part = $this->config->item('cf_search_part'); $btn_prev_part = $btn_next_part = ''; // 분류 선택, 검색어, 검색 파트 적용 if ($sca || $sfl && $stx || $board['bo_count_write'] > $search_part) { if ($stx) { $stx = get_text($stx); } $min_spt = $board['bo_min_wr_num']; if (!$spt) { $spt = $min_spt; } $total_count = $this->Board_model->list_count(BO_TABLE, $spt, $sca, $sfl, $stx); $prev_spt = $spt - $search_part; if ($min_spt && $prev_spt >= $min_spt) { $btn_prev_part = '<li><a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $param->replace('spt', $prev_spt, $qstr) . '">이전검색</a></li>'; } $next_spt = $spt + $search_part; if ($next_spt < 0) { $btn_next_part = '<li><a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $param->replace('spt', $next_spt, $qstr) . '">다음검색</a></li>'; } } else { $total_count = $board['bo_count_write']; } $config['suffix'] = $qstr; $config['base_url'] = RT_PATH . '/board/' . BO_TABLE . '/lists/page/'; $config['per_page'] = $board['bo_page_rows']; $config['total_rows'] = $total_count; $config['uri_segment'] = $seg->pos('page'); // 검색 파트 ADD $config['full_tag_open'] = '<ul class="pagination">' . $btn_prev_part; $config['full_tag_close'] = $btn_next_part . '</ul>'; $CI =& get_instance(); $CI->load->library('pagination', $config); // 정렬 if (!$sst) { if ($board['bo_sort_field']) { $sst = $board['bo_sort_field']; } else { $sst = 'wr_num, wr_reply'; $sod = 'asc'; } } else { $sst = preg_match("/^(wr_datetime|wr_hit)\$/i", $sst) ? $sst : FALSE; } $offset = ($page - 1) * $config['per_page']; $result = $this->Board_model->list_result(BO_TABLE, $spt, $sca, $sst, $sod, $sfl, $stx, $config['per_page'], $offset, $wr_field); // 사이드 뷰 if ($board['bo_use_sideview']) { $this->load->helper('sideview'); } // 일반 리스트 $list = $wr_ids = array(); foreach ($result as $i => $row) { $row = get_convert($row, $board, $board['bo_subject_len'], $qstr, TRUE); $list[$i] = new stdClass(); $list[$i]->num = $total_count - ($page - 1) * $config['per_page'] - $i; $list[$i]->href = $row['href']; $list[$i]->wr_id = $row['wr_id']; $list[$i]->subject = strpos($sfl, 'subject') ? search_font($row['subject'], $stx) : $row['subject']; $list[$i]->comment_cnt = $row['comment_cnt']; $list[$i]->name = $row['name']; $list[$i]->datetime2 = $row['datetime2']; $list[$i]->wr_hit = $row['wr_hit']; $list[$i]->ico_reply = $row['ico_reply']; $list[$i]->ico_new = $row['ico_new']; $list[$i]->ico_hot = $row['ico_hot']; $list[$i]->ico_secret = $row['ico_secret']; $list[$i]->ico_file = $row['ico_file']; $list[$i]->ico_image = $row['ico_image']; $list[$i]->ico_movie = $row['ico_movie']; $wr_ids[$row['wr_id']] = $i; } // Extra if ($board['bo_use_extra'] && $wr_ids) { $result = $this->Board_model->get_extra(BO_TABLE, array_keys($wr_ids)); foreach ($result as $row) { $i = $wr_ids[$row['wr_id']]; foreach ($row as $fld => $val) { $list[$i]->{$fld} = $val; } } } // 공지사항 리스트 if (!$sca && !$stx) { $notice = explode(',', trim($board['bo_notice'])); if ($notice[0]) { $result = $this->Board_model->list_notice(BO_TABLE, $notice, $wr_field); $list_nt = array(); foreach ($result as $i => $row) { $row = get_convert($row, $board, $board['bo_subject_len'], $qstr, TRUE); $list_nt[$i] = new stdClass(); $list_nt[$i]->href = $row['href']; $list_nt[$i]->wr_id = $row['wr_id']; $list_nt[$i]->subject = $row['subject']; $list_nt[$i]->comment_cnt = $row['comment_cnt']; $list_nt[$i]->name = $row['name']; $list_nt[$i]->datetime2 = $row['datetime2']; $list_nt[$i]->wr_hit = $row['wr_hit']; } } } // 리스트 버튼 $btn_list = ''; if ($sfl && $stx) { $btn_list = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/lists' . $sca_str . '" class="btn btn-warning">목록</a>'; } // 글쓰기 버튼 $btn_write = ''; if ($board['bo_use_private'] && !IS_ADMIN) { $btn_write = FALSE; } elseif ($member['mb_level'] >= $board['bo_write_level']) { $btn_write = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/write' . $sca_str . '" class="btn btn-primary"><span class="glyphicon glyphicon-pencil"></span> 글쓰기</a>'; } // RSS 버튼 $btn_rss = ''; if ($board['bo_use_rss']) { $btn_rss = '<a href="' . RT_PATH . '/board/' . BO_TABLE . '/rss" class="btn btn-xs btn-warning" target="_blank">RSS</a>'; } // 관리자 버튼 $btn_admin = ''; if (SU_ADMIN) { $btn_admin = '<a href="' . RT_PATH . '/' . ADM_F . '/board/form/u/' . BO_TABLE . '" class="btn btn-xs btn-primary" target="_blank">관리자</a>'; } else { if (IS_ADMIN) { $btn_admin = '<button type="button" class="btn btn-xs btn-primary" onclick="board_admin();">관리자</button>'; } } // 관리자 체크박스 및 버튼 표시xsxs $btn_chkbox = ''; if (IS_ADMIN) { $btn_chkbox = '<button type="button" class="btn btn-danger" onclick="select_delete();">선택삭제</button>'; if (SU_ADMIN || IS_ADMIN == 'group') { $btn_chkbox .= '<button type="button" class="btn btn-info" onclick="select_copy(\'copy\');">선택복사</button>'; $btn_chkbox .= '<button type="button" class="btn btn-info" onclick="select_copy(\'move\');">선택이동</button>'; } } // 정렬 링크 $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'], 'sca' => $sca); $data = array('total_count' => $total_count, 'category' => $category, 'btn_list' => $btn_list, 'btn_write' => $btn_write, 'btn_rss' => $btn_rss, 'btn_admin' => $btn_admin, 'btn_chkbox' => $btn_chkbox, 'wr_id' => $wr_id, 'sca' => $sca, 'sfl' => $sfl, 'stx' => $stx, 'list' => $list, 'list_nt' => isset($list_nt) ? $list_nt : array(), 'paging' => $CI->pagination->create_links(), 'sort_datetime' => $param->sort('wr_datetime', 'desc'), 'sort_hit' => $param->sort('wr_hit', 'desc')); if ($view) { $this->load->view('board/' . $board['bo_skin'] . '/list', $data); } else { // JavaScript Load if (IS_ADMIN) { $js[] = 'board_check'; } if ($board['bo_use_sideview']) { $js[] = 'sideview'; } if ($board['bo_use_category']) { $js[] = 'category'; } widget::run('head', $head); $this->load->view('board/' . $board['bo_skin'] . '/list', $data); widget::run('tail', array('js' => $js)); } }
function qry() { $this->load->library('querystring'); $param =& $this->querystring; $stx = $param->get('stx'); $type = $this->uri->segment(5, 'write'); $page = $this->uri->segment(4, 1); if (!$stx) { goto_url('/'); } $ori_stx = $stx; $member = unserialize(MEMBER); // 검색 가능 게시판 $result = $this->Search_model->search_board($member['mb_level'], $stx); $boards = array(); foreach ($result as $row) { $boards[] = $row['bo_table']; $levels[$row['bo_table']] = $row['bo_read_level']; } $config['suffix'] = '/' . $type . $param->output(); $config['base_url'] = RT_PATH . '/search/qry/page/'; $config['per_page'] = 20; $config['uri_segment'] = 4; $offset = ($page - 1) * $config['per_page']; $result = $this->Search_model->list_result($type, $stx, $config['per_page'], $offset, $boards); $config['total_rows'] = $result['total_count']; $this->pagination->initialize($config); $list = array(); if ($type == 'write') { // 게시글 foreach ($result['qry'] as $i => $row) { $bo_table = $row['bo_table']; $href = RT_PATH . '/board/' . $bo_table . '/view/wr_id/' . $row['wr_id'] . '?sfl=wr_subject.wr_content&stx=' . $ori_stx; $row['wr_content'] = preg_replace("/\\s+ +/", '', get_text(strip_tags(htmlspecialchars_decode($row['wr_content'])))); $list[$i] = new stdClass(); $list[$i]->href = $href; $list[$i]->subject = search_font(get_text($row['wr_subject']), $stx); $list[$i]->content = $levels[$bo_table] <= $member['mb_level'] ? search_font(cut_str($row['wr_content'], 300), $stx) : ''; // $list[$i]->name = $row['wr_name']; $list[$i]->datetime = substr($row['wr_datetime'], 0, 10); $list[$i]->is_comment = FALSE; $i++; } } else { // 댓글 foreach ($result['qry'] as $i => $row) { $bo_table = $row['bo_table']; $href = RT_PATH . '/board/' . $bo_table . '/view/wr_id/' . $row['wr_id'] . '?sfl=wr_subject.wr_content&stx=' . $ori_stx . '#c_' . $row['co_id']; $row['co_content'] = get_text($row['co_content']); $list[$i] = new stdClass(); $list[$i]->href = $href; $list[$i]->content = $levels[$bo_table] <= $member['mb_level'] ? search_font(cut_str($row['co_content'], 300), $stx) : ''; // $list[$i]->name = $row['co_name']; $list[$i]->datetime = substr($row['co_datetime'], 0, 10); $list[$i]->is_comment = TRUE; } } $head = array('title' => '검색어: ' . get_text(stripslashes($stx))); $data = array('stx' => $ori_stx, 'type' => $type, 'list' => $list, 'total_count' => number_format($config['total_rows']), 'paging' => $this->pagination->create_links()); widget::run('head', $head); $this->load->view('main/search', $data); widget::run('tail'); }
function result() { if (!$this->session->flashdata('ss_mb_reg')) { goto_url('/'); } $mb = $this->Basic_model->get_member($this->session->flashdata('ss_mb_reg'), 'mb_id, mb_name, mb_email'); // 회원정보가 없다면 초기 페이지로 이동 if (!$mb) { goto_url('/'); } $head = array('title' => '회원가입 결과'); $data = array('mb_id' => $mb['mb_id'], 'mb_name' => $mb['mb_name'], 'mb_email' => $mb['mb_email'], 'email_chk' => $this->config->item('cf_use_email_certify')); widget::run('head', $head); $this->load->view('member/join_result', $data); widget::run('tail'); }
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); } }
function index() { $board =& $this->board; $member =& $this->member; $write =& $this->write; $seg =& $this->seg; $param =& $this->param; $w = $seg->get('w'); // 모드 $wr_id = $seg->get('wr_id'); // 게시물아이디 $qstr = $seg->output() . $param->output(); $sca = $param->get('sca'); // 분류 $js = array('jquery/validate'); // JavaScript Files // 개인게시판 권한 if ($board['bo_use_private'] && !IS_ADMIN) { alert('작성 권한이 없습니다.'); } // I will be back. $return_url = url_encode('board/' . BO_TABLE . '/write' . $qstr); // 공지사항 $notice_array = explode(',', trim($board['bo_notice'])); if ($w == 'u' || $w == 'r') { if (!isset($write['wr_id'])) { alert("글이 존재하지 않습니다.\\n\\n삭제되었거나 이동된 경우입니다.", 'board/' . BO_TABLE . '/lists'); } $sca = $write['ca_code']; } if ($w == '') { if ($wr_id) { alert('글쓰기에는 wr_id 값을 사용하지 않습니다.', 'board/' . BO_TABLE); } if ($member['mb_level'] < $board['bo_write_level']) { if (IS_MEMBER) { alert('글을 쓸 권한이 없습니다.'); } else { alert("글을 쓸 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", "member/login/qry/" . $return_url); } } $title_msg = '글쓰기'; } else { if ($w == 'u') { if (IS_MEMBER && $write['mb_id'] == $member['mb_id']) { // 자신의 글이면 통과 } else { if ($member['mb_level'] < $board['bo_write_level']) { if (IS_MEMBER) { alert('글을 수정할 권한이 없습니다.'); } else { alert("글을 수정할 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", "member/login/qry/" . $return_url); } } } // 수정 권한 IF if (IS_ADMIN == 'group' || IS_ADMIN == 'board') { $mb = $this->Basic_model->get_member($write['mb_id'], 'mb_level'); $mb_level = isset($mb['mb_level']) ? $mb['mb_level'] : 1; } if (IS_ADMIN == 'super') { // 통과 } else { if (IS_ADMIN == 'group') { // 그룹관리자 if ($member['mb_id'] == $board['gr_admin']) { // 자신이 관리하는 그룹인가 if ($member['mb_level'] < $mb_level) { // 자신의 레벨이 낮다면 alert('그룹관리자의 권한보다 높은 회원의 글이므로 수정할 수 없습니다.'); } } else { alert('자신이 관리하는 그룹의 게시판이 아니므로 글을 수정할 수 없습니다.'); } } else { if (IS_ADMIN == 'board') { // 게시판관리자 if ($member['mb_id'] == $board['bo_admin']) { // 자신이 관리하는 게시판인가 if ($member['mb_level'] < $mb_level) { // 자신의 레벨이 낮다면 alert('게시판관리자의 권한보다 높은 회원의 글이므로 수정할 수 없습니다.'); } } else { alert('자신이 관리하는 게시판이 아니므로 글을 수정할 수 없습니다.'); } } else { if ($write['mb_id']) { if (!IS_MEMBER || $member['mb_id'] != $write['mb_id']) { alert('자신의 글이 아니므로 수정할 수 없습니다.'); } } else { $CI =& get_instance(); $CI->load->library('encrypt'); if (md5($this->input->post('password')) !== $CI->encrypt->decode($write['wr_password'])) { alert('비밀번호가 맞지 않습니다.'); } } } } } // 원글만 구한다. $cnt = $this->Board_model->is_reply(BO_TABLE, $wr_id, $write['wr_num'], $write['wr_reply']); if ($cnt && !IS_ADMIN) { alert("이 글과 관련된 답변글이 존재하므로 수정할 수 없습니다.\\n\\n답변글이 있는 원글은 수정할 수 없습니다."); } // 댓글 달린 원글의 수정 여부 if ($board['bo_count_modify'] > 0) { $cnt = $this->Board_model->is_comment(BO_TABLE, $wr_id, IS_MEMBER ? $member['mb_id'] : ''); if ($cnt >= $board['bo_count_modify'] && !IS_ADMIN) { alert("이 글과 관련된 댓글가 존재하므로 수정할 수 없습니다.\\n\\n댓글가 " . $board['bo_count_modify'] . "건 이상 달린 원글은 수정할 수 없습니다."); } } $title_msg = '글수정'; } else { if ($w == 'r') { if ($member['mb_level'] < $board['bo_reply_level']) { if (IS_MEMBER) { alert('글을 답변할 권한이 없습니다.'); } else { alert("글을 답변할 권한이 없습니다.\\n\\n회원이라면 로그인 후 이용하세요.", "member/login/qry/" . $return_url); } } if (in_array((int) $wr_id, $notice_array)) { alert('공지에는 답변 할 수 없습니다.'); } // 비밀글인지를 검사 if (strpos($write['wr_option'], 'secret') !== FALSE) { if ($write['mb_id']) { // 회원의 경우는 해당 글쓴 회원 및 관리자 if (!($write['mb_id'] == $member['mb_id'] || IS_ADMIN)) { alert('비밀글에는 자신 또는 관리자만 답변이 가능합니다.'); } } else { // 비회원의 경우는 비밀글에 답변이 불가함 if (!IS_ADMIN) { alert('비회원의 비밀글에는 답변이 불가합니다.'); } } } // 최대 답변은 테이블에 잡아놓은 wr_reply 사이즈만큼만 가능합니다. if (strlen($write['wr_reply']) == 10) { alert("더 이상 답변하실 수 없습니다.\\n\\n답변은 10단계 까지만 가능합니다."); } $reply = $this->Board_model->get_reply_step(BO_TABLE, $write['wr_num'], $board['bo_reply_order'], $write['wr_reply']); $title_msg = '글답변'; } else { alert('잘못된 접근입니다.'); } } } $notice_checked = $secret_checked = 0; // check 필드 $is_notice = $is_nocomt = FALSE; if (IS_ADMIN) { if ($board['bo_use_comment']) { $is_nocomt = TRUE; } if ($w != 'r') { $is_notice = TRUE; if ($w == 'u') { // 답변 수정시 공지 체크 없음 if ($write['wr_reply']) { $is_notice = FALSE; } else { $notice_checked = in_array((int) $wr_id, $notice_array) ? 1 : 0; } } } } $is_secret = $board['bo_use_secret']; $is_editor = $board['bo_use_editor'] ? TRUE : FALSE; $is_email = $this->config->item('cf_use_email') && $board['bo_use_email'] && $this->config->item('cf_email_wr_write') ? TRUE : FALSE; $is_sign = !IS_MEMBER || IS_ADMIN && $w == 'u' && $member['mb_id'] != $write['mb_id'] ? TRUE : FALSE; // 분류 $category = FALSE; if ($board['bo_use_category']) { $this->load->helper('category'); $category = make_category(array('type' => 'bo_' . BO_TABLE, 'id' => 'ca_code', 'code' => $sca)); } $name = $email = ''; if ($w == '' || $w == 'r') { if (IS_MEMBER) { $name = cut_str(get_text($write['wr_name']), 20); $email = $member['mb_email']; } if ($w == 'r' && strpos($write['wr_option'], 'secret') !== FALSE) { $is_secret = TRUE; $secret_checked = 1; } } else { if ($w == 'u') { $name = cut_str(get_text($write['wr_name']), 20); $email = $write['wr_email']; if (strpos($write['wr_option'], 'secret') !== FALSE) { $secret_checked = 1; } } } // 히든 옵션 $option_hidden = ''; if ($is_editor) { $option_hidden .= "<input type='hidden' name='editor' value='editor' />"; } // 옵션 박스 $option = $option_check = array(); if ($is_notice) { $option['notice'] = array('title' => '공지', 'value' => '1'); $option_check['notice'] = $notice_checked; } if ($is_secret) { if (IS_ADMIN || $is_secret == 1) { $option['secret'] = array('title' => '비밀글', 'value' => 'secret'); $option_check['secret'] = $secret_checked; } else { $option_hidden .= "<input type='hidden' name='secret' value='secret' />"; } } if ($is_email) { $option['mail'] = array('title' => '답변메일받기', 'value' => 'mail'); $option_check['mail'] = $w == 'u' && strpos($write['wr_option'], 'mail') !== FALSE ? 1 : 0; } if ($is_nocomt) { $option['nocomt'] = array('title' => '댓글금지', 'value' => 'nocomt'); $option_check['nocomt'] = strpos($write['wr_option'], 'nocomt') !== FALSE ? 1 : 0; } // 제목 $subject = cut_str(get_text($write['wr_subject']), 255); // 내용 if ($w == '') { $content = $board['bo_insert_content']; } else { if ($w == 'r') { $subject = ''; $content = $board['bo_insert_content']; } else { if ($is_editor) { $content = str_replace('&', '&', $write['wr_content']); } else { $content = get_text($write['wr_content']); } } } // 에디터 $editor = $editorConfig = ''; if ($is_editor) { $attach = array(); if ($w == 'u' && ($write['wr_count_file'] || $write['wr_count_image'])) { $CI =& get_instance(); $CI->load->model('Board_file_model'); $result = $CI->Board_file_model->get_files(BO_TABLE, $wr_id, 'bf_no,bf_editor,bf_source,bf_file,bf_filesize', 'all'); $base_url = $this->config->item('base_url'); foreach ($result as $row) { $filename = $row['bf_source']; if ($row['bf_editor']) { $filepath = $base_url . DATA_DIR . '/file/' . BO_TABLE . '/' . $row['bf_file']; $attach['image'][] = array('attacher' => 'image', 'data' => array('imageurl' => $filepath, 'filename' => $filename, 'filesize' => (int) $row['bf_filesize'], 'thumburl' => $filepath)); } else { $attach['file'][] = array('attacher' => 'file', 'data' => array('attachurl' => $base_url . RT_PATH . '/board/' . BO_TABLE . '/download/wr_id/' . $wr_id . '/no/' . $row['bf_no'], 'filemime' => 'application/octet-stream', 'filename' => $filename, 'filesize' => (int) $row['bf_filesize'])); } } } $editorConfig = array('editor' => array('initializedId' => '1', 'wrapper' => 'tx_trex_container', 'form' => 'fwrite', 'field' => 'wr_content', 'content' => $content, 'attachments' => $attach)); $editor = $this->load->view('board/editor', $editorConfig['editor'], TRUE); $content = ''; // 그냥 비우기 } // SyntaxHighlighter $syntax = FALSE; if ($board['bo_use_syntax'] && $is_editor) { $this->load->config('cf_syntax'); $syntax = $this->config->item('brush_name'); } $head = array('title' => $board['gr_subject'] . ' > ' . $board['bo_subject'] . ' > ' . $title_msg, 'sca' => $sca ? str_replace('.', '-', $sca) : ''); $data = array('title_msg' => $title_msg, 'w' => $w, 'wr_id' => $wr_id, 'sca_str' => $sca ? '?sca=' . $sca : '', 'qstr' => $param->replace('w,wr_id'), 'mb_id' => !$w && IS_MEMBER ? $member['mb_id'] : 'guest', 'name' => $name, 'email' => $email, 'subject' => $subject, 'content' => $content, 'editor' => $editor, 'editorConfig' => json_encode($editorConfig), 'option' => $option, 'option_check' => json_encode($option_check), 'option_hidden' => $option_hidden, 'category' => $category, 'is_editor' => $is_editor, 'is_sign' => $is_sign, 'syntax' => $syntax); // Extra if ($board['bo_use_extra']) { if ($w == 'u') { $data = array_merge($data, $this->Board_model->get_extra(BO_TABLE, $wr_id)); } else { $extra = $this->db->list_fields('ki_extra_' . BO_TABLE); foreach ($extra as $fld) { if ($fld == 'wr_id') { continue; } $data[$fld] = FALSE; } } } // JavaScript Load if ($is_editor) { $js[] = '../editor/js/editor_loader'; $js[] = 'editor_config'; } if (!IS_MEMBER) { $js[] = 'md5'; $js[] = 'kcaptcha'; } if ($board['bo_use_category']) { $js[] = 'category'; } widget::run('head', $head); $this->load->view('board/' . $board['bo_skin'] . '/write', $data); widget::run('tail', array('js' => $js)); }
function select_send() { if ($this->input->post('mb_id')) { $member = unserialize(MEMBER); $mb_ids = $this->input->post('mb_id'); $mb_name = $this->input->post('mb_name'); $mb_nick = $this->input->post('mb_nick'); $mb_email = $this->input->post('mb_email'); $mb_birth = $this->input->post('mb_birth'); $ma = $this->Mail_model->get_mail($this->input->post('ma_id'), 'ma_subject,ma_content'); $mail_msg = ''; $mail_fail = 0; $this->load->library('email'); foreach ($mb_ids as $mb_id) { $content = str_replace(array('[이름]', '[별명]', '[회원아이디]', '[이메일]', '[생일]'), array($mb_name[$mb_id], $mb_nick[$mb_id], $mb_id, $mb_email[$mb_id], $mb_birth[$mb_id]), $ma['ma_content']); $this->email->clear(); $this->email->to($mb_email[$mb_id]); $this->email->from($member['mb_email'], $this->config->item('cf_title')); $this->email->subject($ma['ma_subject']); $this->email->message($content); if (!$this->email->send()) { $mail_msg .= $mb_email[$mb_id] . '<br/>'; $mail_fail++; } } } else { alert('잘못된 접근입니다.'); } $head = array('title' => '메일전송 결과'); $data = array('mail_msg' => !$mail_msg ? '없음' : $mail_msg, 'total_cnt' => count($mb_ids) - $mail_fail); widget::run('head', $head); $this->load->view(ADM_F . '/mail_select_send', $data); widget::run('tail'); }
function lists() { $config = array(array('field' => 'mb_id', 'label' => '아이디', 'rules' => 'trim|required|max_length[20]|xss_clean'), array('field' => 'po_content', 'label' => '포인트내용', 'rules' => 'trim|required'), array('field' => 'po_point', 'label' => '포인트', 'rules' => 'trim|required|numeric')); $this->form_validation->set_rules($config); if ($this->form_validation->run() == FALSE) { $param =& $this->querystring; $page = $this->uri->segment(5, 1); $sst = $param->get('sst', 'po_id'); $sod = $param->get('sod', 'desc'); $sfl = $param->get('sfl'); $stx = $param->get('stx'); $config['suffix'] = $param->output(); $config['base_url'] = RT_PATH . '/' . ADM_F . '/point/lists/page/'; $config['per_page'] = 15; $offset = ($page - 1) * $config['per_page']; $result = $this->Point_model->list_result($sst, $sod, $sfl, $stx, $config['per_page'], $offset); $config['total_rows'] = $result['total_cnt']; $this->pagination->initialize($config); if ($sfl == 'mb_id' && $stx && $result['total_cnt'] > 0) { $total_pnt = $stx . ' 님 포인트 합계 : ' . number_format($result['total_pnt']) . '점'; $stx_mb_id = TRUE; } else { $total_pnt = '전체 포인트 합계 : ' . number_format($result['total_pnt']) . '점'; } $list = array(); foreach ($result['qry'] as $i => $row) { $list[$i] = new stdClass(); if ($this->config->item('cf_use_nick')) { $list[$i]->mb_nick = $row['mb_nick']; } $link1 = $link2 = ''; if (!preg_match("/^\\@/", $row['po_rel_table']) && $row['po_rel_table']) { $po_content = "<a href='" . RT_PATH . "/board/view/tbl/" . $row['po_rel_table'] . "/" . $row['po_rel_id'] . " target=_blank'>" . $row['po_content'] . "</a>"; } else { $po_content = $row['po_content']; } $list[$i]->id = $row['po_id']; $list[$i]->mb_id = $row['mb_id']; $list[$i]->datetime = substr($row['po_datetime'], 2, 8); $list[$i]->content = $po_content; $list[$i]->point = number_format($row['po_point']); $list[$i]->mb_name = get_sideview($row['mb_id'], $row['mb_name']); $list[$i]->mb_point = number_format($row['mb_point']); } $head = array('title' => '포인트관리'); $data = array('token' => get_token(), 'list' => $list, 'use_nick' => $this->config->item('cf_use_nick'), 'sfl' => $sfl, 'stx' => $stx, 'stx_mb_id' => isset($stx_mb_id) ? $stx : '', 'total_cnt' => number_format($result['total_cnt']), 'total_pnt' => $total_pnt, 'paging' => $this->pagination->create_links(), 'sort_mb_id' => $param->sort('mb_id'), 'sort_po_datetime' => $param->sort('po_datetime'), 'sort_po_content' => $param->sort('po_content'), 'sort_po_point' => $param->sort('po_point')); widget::run('head', $head); $this->load->view(ADM_F . '/point_list', $data); widget::run('tail'); } else { check_token(); $member = unserialize(MEMBER); $mb_id = $this->input->post('mb_id'); $po_point = $this->input->post('po_point'); $mb = $this->Basic_model->get_member($mb_id, 'mb_id,mb_point'); if (!isset($mb['mb_id'])) { alert('존재하는 회원아이디가 아닙니다.'); } if ($po_point < 0 && $po_point * -1 > $mb['mb_point']) { alert('포인트를 깎는 경우 현재 포인트보다 작으면 안됩니다.'); } $this->load->model('Point_model'); $this->Point_model->insert($mb_id, $po_point, $this->input->post('po_content'), '@passive', $mb_id, $member['mb_id'] . '-' . uniqid('')); goto_url(ADM_F . '/point/lists'); } }
function write($recv_mb_id = FALSE, $me_no = FALSE) { $member = unserialize(MEMBER); if (!$member['mb_open'] && !SU_ADMIN && $member['mb_id'] != $recv_mb_id) { alert_close('자신의 정보를 공개하지 않으면 다른분에게 쪽지를 보낼 수 없습니다.\\n\\n정보공개 설정은 회원정보수정에서 하실 수 있습니다.'); } $this->load->library('form_validation'); $config = array(array('field' => 'recv_mb_id', 'label' => '받는 아이디', 'rules' => 'trim|required|xss_clean'), array('field' => 'me_content', 'label' => '내용', 'rules' => 'trim|required|xss_clean')); $this->form_validation->set_rules($config); if ($this->form_validation->run() == FALSE) { $content = FALSE; // 탈퇴한 회원에게 쪽지 보낼 수 없음 if ($recv_mb_id) { $mb = $this->Basic_model->get_member($recv_mb_id, 'mb_id, mb_open'); if (!isset($mb['mb_id'])) { alert_close('회원정보가 존재하지 않습니다.\\n\\n탈퇴하였을 수 있습니다.'); } if (!$mb['mb_open'] && !SU_ADMIN) { alert_close('정보공개를 하지 않았습니다.'); } } $head = array('title' => '쪽지 보내기'); $data = array('path' => RT_PATH . '/member', 'recv_mb_id' => $recv_mb_id); widget::run('head', $head); $this->load->view('member/memo_write', $data); widget::run('tail'); } else { $tmp_list = array_unique(explode(',', $this->input->post('recv_mb_id'))); $recv_mb_id_list = $msg = $comma1 = $comma2 = FALSE; $mb_list = $mb_array = array(); for ($i = 0; $i < count($tmp_list); $i++) { $row = $this->Basic_model->get_member($tmp_list[$i], 'mb_id, mb_name, mb_nick, mb_open, mb_leave_date'); if (!$row || (!$row['mb_id'] || !$row['mb_open'] || $row['mb_leave_date'])) { $msg .= $comma1 . $tmp_list[$i]; $comma1 = ','; } else { if ($this->config->item('cf_use_nick')) { $recv_mb_id_list .= $comma2 . $row['mb_nick']; } else { $recv_mb_id_list .= $comma2 . $row['mb_name']; } $mb_list[] = $tmp_list[$i]; $mb_array[] = $row; $comma2 = ','; } } if ($msg) { alert("회원아이디 \\'" . $msg . "\\' 은(는) 존재(또는 정보공개)하지 않은 혹은 탈퇴한 회원아이디 입니다.\\n\\n쪽지를 발송하지 않았습니다."); } for ($i = 0; $i < count($mb_list); $i++) { if (trim($mb_list[$i])) { $this->Member_memo_model->insert($member['mb_id'], $mb_list[$i], $this->input->post('me_content')); } } alert("\\'" . $recv_mb_id_list . "\\' 님께 쪽지를 전달하였습니다.", 'member/memo/lists/S'); } }
function password() { if (!IS_MEMBER) { alert('로그인 후 이용하여 주십시오.'); } if (SU_ADMIN) { alert('관리자 아이디는 접근 불가합니다.'); } $member = unserialize(MEMBER); if ($this->encrypt->decode($member['mb_password']) != $this->session->userdata('ss_tmp_password')) { goto_url('/'); } $config = array(array('field' => 'mb_id', 'label' => '아이디', 'rules' => 'trim|required|xss_clean'), array('field' => 'old_password', 'label' => '현재 비밀번호', 'rules' => 'trim|required|min_length[3]|md5'), array('field' => 'new_password', 'label' => '새 비밀번호', 'rules' => 'trim|required|min_length[3]|md5'), array('field' => 'new_password_re', 'label' => '새 비밀번호 확인', 'rules' => 'trim|required|min_length[3]|matches[new_password]|md5'), array('field' => 'wr_key', 'label' => '자동등록방지', 'rules' => 'trim|required')); $this->form_validation->set_rules($config); if ($this->form_validation->run() == FALSE) { $head = array('title' => '비밀번호 변경'); $data = array('mb_id' => $member['mb_id']); widget::run('head', $head); $this->load->view('member/modify_password', $data); widget::run('tail'); } else { check_wrkey(); if ($member['mb_id'] != $this->input->post('mb_id')) { alert("로그인된 회원과 넘어온 정보가 서로 다릅니다."); } if (!($this->encrypt->decode($member['mb_password']) == $this->input->post('old_password') && $this->input->post('old_password'))) { alert("현재 비밀번호가 맞지 않습니다."); } $this->Member_infor_model->update_pwd(); $this->session->unset_userdata('ss_mb_id'); alert('비밀번호가 변경 되었으므로 다시 로그인하여 주시기 바랍니다.', '/'); } }