/** * 마이페이지>로그인기록 입니다 */ public function loginlog() { // 이벤트 라이브러리를 로딩합니다 $eventname = 'event_mypage_loginlog'; $this->load->event($eventname); /** * 로그인이 필요한 페이지입니다 */ required_user_login(); $mem_id = (int) $this->member->item('mem_id'); $view = array(); $view['view'] = array(); // 이벤트가 존재하면 실행합니다 $view['view']['event']['before'] = Events::trigger('before', $eventname); /** * 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다. */ $param =& $this->querystring; $page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1; $this->load->model('Member_login_log_model'); $findex = $this->Member_login_log_model->primary_key; $forder = 'desc'; $per_page = $this->cbconfig->item('list_count') ? (int) $this->cbconfig->item('list_count') : 20; $offset = ($page - 1) * $per_page; /** * 게시판 목록에 필요한 정보를 가져옵니다. */ $where = array('mem_id' => $mem_id); $result = $this->Member_login_log_model->get_list($per_page, $offset, $where, '', $findex, $forder); $list_num = $result['total_rows'] - ($page - 1) * $per_page; if (element('list', $result)) { foreach (element('list', $result) as $key => $val) { if (element('mll_useragent', $val)) { $userAgent = get_useragent_info(element('mll_useragent', $val)); $result['list'][$key]['browsername'] = $userAgent['browsername']; $result['list'][$key]['browserversion'] = $userAgent['browserversion']; $result['list'][$key]['os'] = $userAgent['os']; $result['list'][$key]['engine'] = $userAgent['engine']; } $result['list'][$key]['num'] = $list_num--; } } $view['view']['data'] = $result; /** * 페이지네이션을 생성합니다 */ $config['base_url'] = site_url('mypage/loginlog') . '?' . $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; // 이벤트가 존재하면 실행합니다 $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname); /** * 레이아웃을 정의합니다 */ $page_title = $this->cbconfig->item('site_meta_title_mypage_loginlog'); $meta_description = $this->cbconfig->item('site_meta_description_mypage_loginlog'); $meta_keywords = $this->cbconfig->item('site_meta_keywords_mypage_loginlog'); $meta_author = $this->cbconfig->item('site_meta_author_mypage_loginlog'); $page_name = $this->cbconfig->item('site_page_name_mypage_loginlog'); $layoutconfig = array('path' => 'mypage', 'layout' => 'layout', 'skin' => 'loginlog', 'layout_dir' => $this->cbconfig->item('layout_mypage'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_mypage'), 'use_sidebar' => $this->cbconfig->item('sidebar_mypage'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_mypage'), 'skin_dir' => $this->cbconfig->item('skin_mypage'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_mypage'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name); $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->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 index($userid = '') { // 이벤트 라이브러리를 로딩합니다 $eventname = 'event_profile_index'; $this->load->event($eventname); /** * 로그인이 필요한 페이지입니다 */ required_user_login(); $view = array(); $view['view'] = array(); // 이벤트가 존재하면 실행합니다 $view['view']['event']['before'] = Events::trigger('before', $eventname); if (empty($userid)) { show_404(); } if (!$this->member->item('mem_open_profile') && $this->member->is_admin() !== 'super' && $this->member->item('mem_userid') !== $userid) { alert_close('회원님이 프로필 공개를 하지 않으셨으므로, 상대방의 프로필을 볼 수 없습니다. 먼저 회원님의 프로필을 공개해주세요'); return false; } $view['view']['member'] = $member = $this->Member_model->get_by_userid($userid); $member_meta = $this->Member_meta_model->get_all_meta(element('mem_id', $member)); if (is_array($member_meta)) { $view['view']['member'] = $member = array_merge($view['view']['member'], $member_meta); } if (!element('mem_id', $member)) { alert_close('존재하지 않는 회원아이디입니다'); return false; } if (element('mem_denied', $member)) { alert_close('탈퇴 또는 차단된 회원아이디입니다'); return false; } $member_extra_vars = $this->Member_extra_vars_model->get_all_meta(element('mem_id', $member)); if (is_array($member_extra_vars)) { $view['view']['member'] = $member = array_merge($view['view']['member'], $member_extra_vars); } if (!element('mem_open_profile', $member) && $this->member->is_admin() !== 'super' && $this->member->item('mem_userid') !== $userid) { alert_close(html_escape(element('mem_nickname', $member)) . ' 님이 프로필을 공개하지 않으셨습니다'); return false; } $registerform = $this->cbconfig->item('registerform'); $form = json_decode($registerform, true); $display = array(); if ($form && is_array($form)) { foreach ($form as $key => $value) { if (element('use', $value) && element('open', $value)) { if (element('field_name', $value) === 'mem_address') { $value['value'] = element('mem_zipcode', $member) . ' ' . element('mem_address1', $member) . ' ' . element('mem_address2', $member) . ' ' . element('mem_address3', $member); } else { $value['value'] = element(element('field_name', $value), $member); if (element('field_type', $value) === 'checkbox') { $tmp_value = json_decode($value['value']); $tmp = ''; if ($tmp_value) { foreach ($tmp_value as $val) { if ($tmp) { $tmp .= ', '; } $tmp .= $val; } } $value['value'] = $tmp; } } $display[] = $value; } } } $view['data'] = $display; $view['view']['canonical'] = site_url('profile/' . $userid); // 이벤트가 존재하면 실행합니다 $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname); /** * 레이아웃을 정의합니다 */ $page_title = $this->cbconfig->item('site_meta_title_profile'); $meta_description = $this->cbconfig->item('site_meta_description_profile'); $meta_keywords = $this->cbconfig->item('site_meta_keywords_profile'); $meta_author = $this->cbconfig->item('site_meta_author_profile'); $page_name = $this->cbconfig->item('site_page_name_profile'); $searchconfig = array('{프로필회원명}', '{프로필회원아이디}'); $replaceconfig = array(element('mem_nickname', $member), element('mem_userid', $member)); $page_title = str_replace($searchconfig, $replaceconfig, $page_title); $meta_description = str_replace($searchconfig, $replaceconfig, $meta_description); $meta_keywords = str_replace($searchconfig, $replaceconfig, $meta_keywords); $meta_author = str_replace($searchconfig, $replaceconfig, $meta_author); $page_name = str_replace($searchconfig, $replaceconfig, $page_name); $layoutconfig = array('path' => 'profile', 'layout' => 'layout_popup', 'skin' => 'profile', 'layout_dir' => $this->cbconfig->item('layout_profile'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_profile'), 'skin_dir' => $this->cbconfig->item('skin_profile'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_profile'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name); $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->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($userid = '') { // 이벤트 라이브러리를 로딩합니다 $eventname = 'event_formmail_write'; $this->load->event($eventname); $view = array(); $view['view'] = array(); // 이벤트가 존재하면 실행합니다 $view['view']['event']['before'] = Events::trigger('before', $eventname); /** * 로그인이 필요한 페이지입니다 */ required_user_login(); if ($this->cbconfig->get_device_view_type() !== 'mobile' && !$this->cbconfig->item('use_sideview_email')) { alert_close('이메일 기능을 사용하지 않는 사이트입니다'); return false; } elseif ($this->cbconfig->get_device_view_type() === 'mobile' && !$this->cbconfig->item('use_mobile_sideview_email')) { alert_close('모바일 버전에서는 이메일 기능을 사용하지 않는 사이트입니다'); return false; } elseif (!$this->member->item('mem_receive_email') && $this->member->is_admin() !== 'super') { alert_close('회원님은 메일수신에 체크하지 않으셨습니다. 회원정보 수정 페이지에 가셔서, 메일 수신에 체크하신 후에 사용이 가능합니다'); return false; } if (empty($userid)) { alert_close('상대방이 지정되지 않았습니다'); return false; } $view['view']['userid'] = $userid; $memberselect = 'mem_id, mem_denied, mem_receive_email, mem_nickname, mem_email'; $view['view']['member'] = $member = $this->Member_model->get_by_userid($userid, $memberselect); if (!element('mem_id', $member)) { alert_close('존재하지 않는 회원 아이디입니다'); return false; } if (element('mem_denied', $member)) { alert_close('탈퇴 또는 차단된 회원입니다'); return false; } if (!element('mem_receive_email', $member) && $this->member->is_admin() !== 'super') { alert_close(html_escape(element('mem_nickname', $member)) . ' 님은 메일 수신을 원하지 않으십니다'); return false; } $view['view']['use_dhtml'] = false; if ($this->cbconfig->item('use_formmail_dhtml')) { $view['view']['use_dhtml'] = true; } /** * Validation 라이브러리를 가져옵니다 */ $this->load->library('form_validation'); /** * 전송된 데이터의 유효성을 체크합니다 */ $config = array(array('field' => 'title', 'label' => '제목', 'rules' => 'trim|required'), array('field' => 'content', 'label' => '내용', 'rules' => 'trim|required')); $this->form_validation->set_rules($config); /** * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다. * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다 */ if ($this->form_validation->run() === false) { // 이벤트가 존재하면 실행합니다 $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname); /** * 레이아웃을 정의합니다 */ $page_title = $this->cbconfig->item('site_meta_title_formmail'); $meta_description = $this->cbconfig->item('site_meta_description_formmail'); $meta_keywords = $this->cbconfig->item('site_meta_keywords_formmail'); $meta_author = $this->cbconfig->item('site_meta_author_formmail'); $page_name = $this->cbconfig->item('site_page_name_formmail'); $layoutconfig = array('path' => 'formmail', 'layout' => 'layout_popup', 'skin' => 'formmail', 'layout_dir' => $this->cbconfig->item('layout_formmail'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_formmail'), 'skin_dir' => $this->cbconfig->item('skin_formmail'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_formmail'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name); $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->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 { // 이벤트가 존재하면 실행합니다 $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname); // 메일 발송 $this->load->library('email'); $this->email->from($this->member->item('mem_email'), $this->member->item('mem_nickname')); $this->email->to(element('mem_email', $member)); $this->email->subject($this->input->post('title')); $content_type = $this->cbconfig->item('use_formmail_dhtml') ? 1 : 0; $this->email->message(display_html_content($this->input->post('content'), $content_type, 800)); $this->email->send(); alert_close(element('mem_nickname', $member) . ' 님에게 메일을 발송하였습니다. '); } }
/** * 알림 선택 읽음으로 표시 입니다 */ public function listupdate() { // 이벤트 라이브러리를 로딩합니다 $eventname = 'event_notification_listupdate'; $this->load->event($eventname); /** * 로그인이 필요한 페이지입니다 */ required_user_login(); // 이벤트가 존재하면 실행합니다 Events::trigger('before', $eventname); /** * 체크한 게시물의 업데이트를 실행합니다 */ if ($this->input->post('chk') && is_array($this->input->post('chk'))) { foreach ($this->input->post('chk') as $val) { if ($val) { $this->Notification_model->mark_read($val, $this->member->item('mem_id')); } } } // 이벤트가 존재하면 실행합니다 Events::trigger('after', $eventname); /** * 삭제가 끝난 후 목록페이지로 이동합니다 */ $this->session->set_flashdata('message', '정상적으로 삭제되었습니다'); $param =& $this->querystring; redirect('notification?' . $param->output()); }
/** * 회원탈퇴 페이지입니다 */ public function memberleave() { // 이벤트 라이브러리를 로딩합니다 $eventname = 'event_membermodify_memberleave'; $this->load->event($eventname); /** * 로그인이 필요한 페이지입니다 */ required_user_login(); $mem_id = (int) $this->member->item('mem_id'); $view = array(); $view['view'] = array(); // 이벤트가 존재하면 실행합니다 $view['view']['event']['before'] = Events::trigger('before', $eventname); $this->load->library(array('form_validation')); $login_fail = false; $valid_fail = false; /** * 전송된 데이터의 유효성을 체크합니다 */ $config = array(array('field' => 'mem_password', 'label' => '패스워드', 'rules' => 'trim|required|min_length[4]|callback__cur_password_check')); $this->form_validation->set_rules($config); /** * 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다. * 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다 */ if ($this->form_validation->run() === false) { // 이벤트가 존재하면 실행합니다 $view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname); /** * 레이아웃을 정의합니다 */ $page_title = $this->cbconfig->item('site_meta_title_membermodify_memberleave'); $meta_description = $this->cbconfig->item('site_meta_description_membermodify_memberleave'); $meta_keywords = $this->cbconfig->item('site_meta_keywords_membermodify_memberleave'); $meta_author = $this->cbconfig->item('site_meta_author_membermodify_memberleave'); $page_name = $this->cbconfig->item('site_page_name_membermodify_memberleave'); if ($this->member->is_admin() === 'super') { $skin = 'member_admin'; } else { $skin = 'memberleave_password'; } $layoutconfig = array('path' => 'mypage', 'layout' => 'layout', 'skin' => $skin, 'layout_dir' => $this->cbconfig->item('layout_mypage'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_mypage'), 'use_sidebar' => $this->cbconfig->item('sidebar_mypage'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_mypage'), 'skin_dir' => $this->cbconfig->item('skin_mypage'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_mypage'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name); $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->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 처리가 필요한 상황입니다 */ // 이벤트가 존재하면 실행합니다 $view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname); $updatedata = array('mem_level' => 0, 'mem_denied' => 1, 'mem_use_note' => 0, 'mem_receive_sms' => 0, 'mem_receive_email' => 0, 'mem_is_admin' => 0); $metadata = array('meta_denied_datetime' => cdate('Y-m-d H:i:s'), 'meta_denied_by_mem_id' => $mem_id); $this->Member_model->update($mem_id, $updatedata); $this->Member_meta_model->save($mem_id, $metadata); $emailsendlistadmin = array(); $notesendlistadmin = array(); $emailsendlistuser = array(); $notesendlistuser = array(); $superadminlist = ''; if ($this->cbconfig->item('send_email_memberleave_admin') or $this->cbconfig->item('send_note_memberleave_admin')) { $mselect = 'mem_id, mem_email, mem_nickname, mem_phone'; $superadminlist = $this->Member_model->get($mselect); } if ($this->cbconfig->item('send_email_memberleave_admin') && $superadminlist) { foreach ($superadminlist as $key => $value) { $emailsendlistadmin[$value['mem_id']] = $value; } } if ($this->cbconfig->item('send_email_memberleave_user') && $this->member->item('mem_receive_email') or $this->cbconfig->item('send_email_memberleave_alluser')) { $emailsendlistuser['mem_email'] = $this->member->item('mem_email'); } if ($this->cbconfig->item('send_note_memberleave_admin') && $superadminlist) { foreach ($superadminlist as $key => $value) { $notesendlistadmin[$value['mem_id']] = $value; } } $searchconfig = array('{홈페이지명}', '{회사명}', '{홈페이지주소}', '{회원아이디}', '{회원닉네임}', '{회원실명}', '{회원이메일}', '{메일수신여부}', '{쪽지수신여부}', '{문자수신여부}', '{회원아이피}'); $receive_email = $this->member->item('mem_receive_email') ? '동의' : '거부'; $receive_note = $this->member->item('mem_use_note') ? '동의' : '거부'; $receive_sms = $this->member->item('mem_receive_sms') ? '동의' : '거부'; $replaceconfig = array($this->cbconfig->item('site_title'), $this->cbconfig->item('company_name'), site_url(), $this->member->item('mem_userid'), $this->member->item('mem_nickname'), $this->member->item('mem_username'), $this->member->item('mem_email'), $receive_email, $receive_note, $receive_sms, $this->input->ip_address()); $replaceconfig_escape = array(html_escape($this->cbconfig->item('site_title')), html_escape($this->cbconfig->item('company_name')), site_url(), html_escape($this->member->item('mem_userid')), html_escape($this->member->item('mem_nickname')), html_escape($this->member->item('mem_username')), html_escape($this->member->item('mem_email')), $receive_email, $receive_note, $receive_sms, $this->input->ip_address()); if ($emailsendlistadmin) { $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_memberleave_admin_title')); $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_memberleave_admin_content')); foreach ($emailsendlistadmin as $akey => $aval) { $this->email->clear(true); $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name')); $this->email->to(element('mem_email', $aval)); $this->email->subject($title); $this->email->message($content); $this->email->send(); } } if ($emailsendlistuser) { $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_email_memberleave_user_title')); $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_email_memberleave_user_content')); $this->email->clear(true); $this->email->from($this->cbconfig->item('webmaster_email'), $this->cbconfig->item('webmaster_name')); $this->email->to(element('mem_email', $emailsendlistuser)); $this->email->subject($title); $this->email->message($content); $this->email->send(); } if ($notesendlistadmin) { $title = str_replace($searchconfig, $replaceconfig, $this->cbconfig->item('send_note_memberleave_admin_title')); $content = str_replace($searchconfig, $replaceconfig_escape, $this->cbconfig->item('send_note_memberleave_admin_content')); foreach ($notesendlistadmin as $akey => $aval) { $note_result = $this->notelib->send_note($sender = 0, $receiver = element('mem_id', $aval), $title, $content, 1); } } $this->session->sess_destroy(); // 이벤트가 존재하면 실행합니다 $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname); /** * 레이아웃을 정의합니다 */ $page_title = $this->cbconfig->item('site_meta_title_membermodify_memberleave'); $meta_description = $this->cbconfig->item('site_meta_description_membermodify_memberleave'); $meta_keywords = $this->cbconfig->item('site_meta_keywords_membermodify_memberleave'); $meta_author = $this->cbconfig->item('site_meta_author_membermodify_memberleave'); $page_name = $this->cbconfig->item('site_page_name_membermodify_memberleave'); $layoutconfig = array('path' => 'mypage', 'layout' => 'layout', 'skin' => 'memberleave', 'layout_dir' => $this->cbconfig->item('layout_mypage'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_mypage'), 'use_sidebar' => $this->cbconfig->item('sidebar_mypage'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_mypage'), 'skin_dir' => $this->cbconfig->item('skin_mypage'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_mypage'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name); $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->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)); } }