</tr> <?php if ($total_cnt > 0) { foreach ($revision as $k => $v) { ?> <tr> <td><?php echo $v->value; ?> </td> <td><?php echo name($v->user_id, $v->name, $v->nickname); ?> </td> <td><?php echo time2date($v->timestamp); ?> </td> <td><?php echo $v->client_ip; ?> </td> </tr> <?php } } ?> </tbody> </table> <div id = "pagination" align = "center"><?php
?> : <?php echo time2date($v->timestamp_insert); ?> (<?php echo $v->client_ip_insert; ?> )<br /> <?php if ($v->timestamp_update) { ?> <?php echo lang('update_time'); ?> : <?php echo time2date($v->timestamp_update); ?> (<?php echo $v->client_ip_update; ?> )<br /> <?php } ?> <?php echo lang('vote'); ?> : <input type = "text" class = "text" name = "vote_count" id = "vote_count" value = "<?php echo $v->vote_count; ?> " /> (<?php
public function get_message() { $params = $this->input->post(); $idx = $params['idx']; $search = $params['search']; $this->load->model('users_message_model'); $result = $this->users_message_model->view_message($search, $idx); $result->kind = $search; $result->print_name = name($result->user_id, $result->name, $result->nickname); $result->contents = nl2br($result->contents); $result->print_receive_date = $search === 'send' ? time2date($result->timestamp_receive) : ''; //읽음처리 //최소한만 호출 if ($search == 'receive' && $result->is_read == 0 && $result->receiver_user_idx == USER_INFO_idx) { $result->timestamp_receive = time(); //리턴값으로 처리까지는 없다. $this->users_message_model->read_message($idx); } echo json_encode($result); }
/** * 뷰 * * @author KangMin */ public function view() { $this->add_language_pack($this->language_pack('bbs_view')); $req_idx = (int) $this->input->get_post('idx') > 0 ? (int) $this->input->get_post('idx') : NULL; $req_page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1; $this->load->model('bbs_article_model'); //유효성 $check_idx = $this->bbs_article_model->check_idx($req_idx, ' AND bbs_idx = ' . $this->bbs_idx . ' AND is_deleted = 0 '); if ($check_idx !== TRUE) { $req_idx = NULL; } $assign = array(); $assign['bbs_id'] = $this->bbs_id; $assign['bbs_idx'] = $this->bbs_idx; $assign['idx'] = $req_idx; //게시물 유효성 검사 실패거나 권한이 없으면 if ($this->allowed_list['view_article'] === FALSE or $req_idx == NULL) { if ($req_idx == NULL) { $assign['message'] = lang('none_article'); } else { $assign['message'] = lang('deny_allow'); } $assign['redirect'] = '/bbs/lists/' . $this->bbs_id . '?page=' . $req_page; $this->alert($assign); } else { //category $view_category = $this->get_view_category(); $assign['view_category'] = $view_category['view_category']; $assign['lists_style'] = $this->input->get_post('lists_style'); //article, contents, hit $assign['view'] = $this->bbs_article_model->view($req_idx, ' AND BBS_ARTICLE.is_deleted = 0 '); $block_secret = FALSE; //비밀글이면 본인과 관리자만 if ($assign['view']->is_secret == 1 && USER_INFO_group_idx !== SETTING_admin_group_idx) { if (!defined('USER_INFO_idx') or USER_INFO_idx !== (int) $assign['view']->user_idx) { $block_secret = TRUE; } } if ($block_secret == TRUE) { $assign['message'] = lang('is_secret'); $assign['redirect'] = '/bbs/lists/' . $this->bbs_id . '?page=' . $req_page; $this->alert($assign); } else { $this->load->helper('text'); //욕필터링때문에 $this->load->model('bbs_comment_model'); $this->load->model('bbs_tag_model'); $this->load->model('bbs_url_model'); $this->load->model('bbs_file_model'); $this->load->model('bbs_vote_model'); $this->load->model('bbs_hit_model'); //욕필터링 $block_string = array(); if (BBS_SETTING_bbs_block_string_used == 1) { $block_string = unserialize(BBS_SETTING_bbs_block_string); } $assign['view']->print_name = name($assign['view']->user_id, $assign['view']->name, $assign['view']->nickname); if ($assign['view']->avatar_used == 1 and SETTING_avatar_used == 1 and file_exists("./avatars/{$assign['view']->user_id}.gif") === TRUE) { $assign['view']->avatar_used = TRUE; } else { $assign['view']->avatar_used = FALSE; } //$assign['view']->contents = nl2br(auto_link(word_censor(html_purify($assign['view']->contents), $block_string), 'url', TRUE)); // url, email, both 3가지가 있는데, jquerymbolie 출동나서.. $assign['view']->contents = auto_link(word_censor(htmlspecialchars_decode($assign['view']->contents), $block_string), 'url', TRUE); // url, email, both 3가지가 있는데, jquerymbolie 출동나서.. if ($assign['view']->agent_insert != 'P') { $assign['view']->contents = nl2br($assign['view']->contents); } $assign['view']->print_insert_date = time2date($assign['view']->timestamp_insert); $assign['view']->print_update_date = time2date($assign['view']->timestamp_update); //tags $assign['print_tags'] = NULL; if (BBS_SETTING_bbs_tags_used == 1) { $assign['tags'] = $this->bbs_tag_model->get_tags($req_idx); $tags_temp = array(); foreach ($assign['tags'] as $k => &$v) { $tags_temp[] = word_censor($v->tag, $block_string); } if (count($tags_temp) > 0) { $assign['print_tags'] = join(',', $tags_temp); } } //urls if (BBS_SETTING_bbs_urls_used == 1) { $assign['urls'] = $this->bbs_url_model->get_urls($req_idx); foreach ($assign['urls'] as $k => &$v) { $v->print_url = anchor_popup($v->url, word_censor($v->url, $block_string)); } } //files //다운로드 권한은 뷰에서 처리 $assign['files'] = $this->bbs_file_model->get_files($req_idx); $assign['images'] = array(); foreach ($assign['files'] as $k => &$v) { if ($this->allowed_list['download'] === TRUE) { //$v->print = anchor_popup(BASE_URL . $this->upload_path . $v->conversion_filename, word_censor($v->original_filename, $block_string) . ' (' . byte_format($v->capacity) . ')'); $v->print = anchor_popup(BASE_URL . 'bbs/download/' . $this->bbs_id . '?idx=' . $v->idx, word_censor($v->original_filename, $block_string) . ' (' . byte_format($v->capacity) . ')'); } else { $v->print = word_censor($v->original_filename, $block_string) . ' (' . byte_format($v->capacity) . ') - ' . lang('deny_allow'); } $v->is_image = in_array($v->mime, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png')); if ($v->is_image) { if (file_exists($this->upload_path . $v->conversion_filename)) { $assign['images'][] = BASE_URL . $this->upload_path . $v->conversion_filename; $thumb_filepath = explode('.', $v->conversion_filename); $thumb_filepath = $thumb_filepath[0] . '_thumb.' . $thumb_filepath[1]; if (file_exists($this->upload_path . $thumb_filepath)) { $assign['thumbs'][] = BASE_URL . $this->upload_path . $thumb_filepath; } else { $assign['thumbs'][] = BASE_URL . $this->upload_path . $v->conversion_filename; } } } } //hit update //글쓸때 넣어도 되겠지만, 한번도 읽히지 않을수도 있고 쓰자마자 지우면 delete는 안할거니 불필요 row가 생길수있어서 여기서... //코멘트 페이지 넘어갈때도 히트수가 올라가서 간단히 코멘트 페이지 링크에 hit=not 을 붙인다. //국내정서에는 세션으로 시각체크해서 hit를 올리고 하긴하는데.. 그냥 하자.. 큰 의미없다.. 올릴라면 올려라 //hit=not을 붙인채로 즐겨찾기된 상태에서 들어온거면 똥이되지만.. hit는 그냥 대충... if ($this->input->get('hit') != 'not') { if ($this->bbs_hit_model->check($this->bbs_idx, $req_idx) == TRUE) { $this->bbs_hit_model->update($this->bbs_idx, $req_idx); } else { $this->bbs_hit_model->insert($this->bbs_idx, $req_idx); } } //추천/스크랩 중복여부 확인 //버튼을 안보이게 하려다가 그냥 보이고 중복체크하는게 나을듯... //뭐는 보이고 뭐는 안보이고 헤깔려할수도 있고 //추천/스크랩을 많이 사용하지 않는다면 오히려 필요없는 select 가 될듯해서 //추후 변경가능 /* $assign['check_duplicate_vote'] = TRUE; if(defined('USER_INFO_idx')) { $assign['check_duplicate_vote'] = $this->bbs_vote_model->check_duplicate('article', $req_idx); } $assign['check_duplicate_scrap'] = TRUE if(defined('USER_INFO_idx')) { $assign['check_duplicate_scrap'] = $this->users_url_model->check_duplicate_scrap($req_idx); } */ //브라우저타이틀 = 제목 if (SETTING_browser_title_type == 1) { $browser_title = word_censor(strip_tags(htmlspecialchars_decode($assign['view']->title)), $block_string) . ' - ' . SETTING_browser_title_fix_value; //적절히? $this->assign['browser_title'] = str_replace("'", "\\'", $browser_title); } //이전글,다음글 //비밀글 스킵처리 if (USER_INFO_group_idx !== SETTING_admin_group_idx) { if (defined('USER_INFO_idx')) { $add_where_pre_next = ' AND (is_secret = 0 OR (is_secret = 1 AND user_idx = ' . USER_INFO_idx . ')) '; } else { $add_where_pre_next = ' AND is_secret = 0 '; } } else { $add_where_pre_next = ''; } $assign['pre_next'] = $this->bbs_article_model->get_pre_next($this->bbs_idx, $req_idx, ' AND is_deleted = 0 ' . $add_where_pre_next . $view_category['query_where']); $assign['pre_next']->is_exists_pre = !empty($assign['pre_next']->idx_pre) ? TRUE : FALSE; $assign['pre_next']->is_exists_next = !empty($assign['pre_next']->idx_next) ? TRUE : FALSE; $assign['pre_next']->title_pre = word_censor($assign['pre_next']->title_pre, $block_string); $assign['pre_next']->title_next = word_censor($assign['pre_next']->title_next, $block_string); //comment if ($this->allowed_list['view_comment'] === TRUE && BBS_SETTING_bbs_comment_used == 1) { //page $assign['page_comment'] = (int) $this->input->get('page_comment') > 0 ? (int) $this->input->get('page_comment') : 1; $this->load->library('pagination'); $assign['total_cnt_comment'] = $this->bbs_comment_model->lists_total_cnt($req_idx, ' AND BBS_COMMENT.is_deleted = 0 '); $this->config->load('pagination'); $pagination_config = $this->config->item($this->viewport); unset($config); // http://codeigniter-kr.org/user_guide_2.1.0/libraries/pagination.html $config['base_url'] = BASE_URL . 'bbs/view/' . $this->bbs_id . '?idx=' . $req_idx . '&page=' . $req_page . '&hit=not' . $view_category['param_add'] . '&lists_style=' . $this->input->get_post('lists_style'); $config['enable_query_strings'] = TRUE; // ?page=10 이런 일반 get 방식 $config['page_query_string'] = TRUE; $config['use_page_numbers'] = TRUE; $config['num_links'] = (int) BBS_SETTING_bbs_count_page_comment; $config['query_string_segment'] = 'page_comment'; $config['total_rows'] = $assign['total_cnt_comment']; $config['per_page'] = (int) BBS_SETTING_bbs_count_list_comment; $config = array_merge($config, $pagination_config); $this->pagination->initialize($config); $assign['comment_pagination'] = $this->pagination->create_links(); //lists_comment $assign['lists_comment'] = $this->bbs_comment_model->lists($req_idx, ($assign['page_comment'] - 1) * $config['per_page'], $config['per_page'], BBS_SETTING_bbs_comment_sort, ' AND BBS_COMMENT.is_deleted = 0 '); $cnt = 0; foreach ($assign['lists_comment'] as $k => &$v) { $v->even_class = $cnt % 2 == 0 ? 'comment_even_row' : ''; if ((int) $v->timestamp_insert >= time() - (int) BBS_SETTING_bbs_hour_new_icon_value_comment * 60 * 60) { $v->new_comment_icon = BBS_SETTING_bbs_hour_new_icon_path_comment; } else { $v->new_comment_icon = ''; } $v->print_name = name($v->user_id, $v->name, $v->nickname); $v->print_insert_date = time2date($v->timestamp_insert); $v->print_update_date = time2date($v->timestamp_update); //$v->comment = nl2br(auto_link(word_censor(html_purify($v->comment), $block_string), 'url', TRUE)); // url, email, both 3가지가 있는데, jquerymbolie 충돌나서.. //$v->comment = nl2br(auto_link(word_censor($v->comment, $block_string), 'url', TRUE)); // url, email, both 3가지가 있는데, jquerymbolie 충돌나서.. $v->comment = auto_link(word_censor(htmlspecialchars_decode($v->comment), $block_string), 'url', TRUE); // url, email, both 3가지가 있는데, jquerymbolie 충돌나서.. if ($v->agent_insert !== 'P') { $v->comment = nl2br($v->comment); } $cnt++; } } //이동할 페이지를 재계산해서 보내기 $article_total_cnt = $this->bbs_article_model->lists_total_cnt($this->bbs_idx, ' AND BBS_ARTICLE.idx > ' . $req_idx . ' AND BBS_ARTICLE.is_deleted = 0 ' . $view_category['query_where_as']); $assign['page'] = floor($article_total_cnt / BBS_SETTING_bbs_count_list_article) + 1; $assign['view'] = $this->word_censor(array('title', 'contents'), $assign['view'], $block_string); //$this->layout->view('bbs/view_view', $data); $this->scope('contents', 'contents/bbs/view', $assign); $this->display('layout'); } } }
/** * 검색결과 * * @desc 게시판 리스트와 동일 (팝업) * @author KangMin * @since 2012.02.25 */ public function index() { $this->add_language_pack($this->language_pack('bbs_search')); $assign = NULL; $this->load->helper('security'); //search_word $assign['search_word'] = xss_clean(str_replace(array('"', "'", '?'), '', trim($this->input->get('search_word')))); //따옴표 검색은 필요없겄지.. //접속자가 검색할 수 있는 조건 //어차피 검색결과가 리스트니까 리스트권한만 $allow_bbs_list = array(); //네이밍이 좀 이상한데 이게 article 테이블용 if (!defined('USER_INFO_group_idx')) { define('USER_INFO_group_idx', 0); } $this->load->model('bbs_setting_model'); $bbs_allow_group_view_list = $this->bbs_setting_model->get_bbs_setting_section(array('bbs_allow_group_view_list')); foreach ($bbs_allow_group_view_list as $k => $v) { $value = unserialize($v->value); if (in_array(USER_INFO_group_idx, $value) == TRUE) { $allow_bbs_list[] = $v->bbs_idx; } } $allow_bbs_list = array_unique($allow_bbs_list); //권한있는 테이블이 없으면 if (count($allow_bbs_list) < 1) { $assign['message'] = lang('deny_allow'); $assign['redirect'] = '/'; $this->alert($assign); } else { if (strlen($assign['search_word']) < 1) { $assign['message'] = lang('need_search_word'); $assign['redirect'] = '/'; $this->alert($assign); } else { $this->load->helper('text'); //욕필터링때문에 //욕필터링 //게시판별 모든 욕필터링을 가져와서 $assign['block_string'] = array(); $block_string = $this->bbs_setting_model->get_bbs_block_string(); foreach ($block_string as $k => $v) { $assign['block_string'][$v->bbs_idx] = unserialize($v->value); } //page $assign['page'] = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1; $this->load->library('pagination'); $this->load->model('bbs_article_model'); $assign['total_cnt'] = $this->bbs_article_model->lists_search_total_cnt($assign['search_word'], $allow_bbs_list, ' AND BBS_ARTICLE.is_deleted = 0 '); $this->config->load('pagination'); $pagination_config = $this->config->item($this->viewport); unset($config); // http://codeigniter-kr.org/user_guide_2.1.0/libraries/pagination.html $config['base_url'] = BASE_URL . 'search?search_word=' . $assign['search_word']; $config['enable_query_strings'] = TRUE; // ?page=10 이런 일반 get 방식 $config['page_query_string'] = TRUE; $config['use_page_numbers'] = TRUE; $config['num_links'] = (int) SETTING_count_page_search; $config['query_string_segment'] = 'page'; $config['total_rows'] = $assign['total_cnt']; $config['per_page'] = (int) SETTING_count_list_search; $config = array_merge($config, $pagination_config); $this->pagination->initialize($config); $assign['pagination'] = $this->pagination->create_links(); //lists $assign['lists'] = $this->bbs_article_model->lists_search($assign['search_word'], ($assign['page'] - 1) * $config['per_page'], $config['per_page'], $allow_bbs_list, ' AND BBS_ARTICLE.is_deleted = 0 '); foreach ($assign['lists'] as $k => &$v) { $v->print_title = cut_string(word_censor($v->title, $assign['block_string'][$v->bbs_idx]), SETTING_cut_length_title_search); $v->print_name = name($v->user_id, $v->name, $v->nickname); $v->print_insert_date = time2date($v->timestamp_insert); } $this->scope('contents', 'contents/bbs/search', $assign); $this->display('layout'); } } }
" /> <tr> <td><?php echo $v->idx; ?> </td> <td><?php echo $v->point; ?> </td> <td><?php echo $alliance; ?> </td> <td><?php echo time2date($v->exec_timestamp); ?> </td> <td><?php echo name($v->exec_user_id, $v->exec_name, $v->exec_nickname); ?> <br /> <?php echo $v->exec_client_ip; ?> </td> <td style = "<?php if ($v->is_deleted == 1) { echo 'background-color:#ffc1c1'; } ?>
/** * 게시판 최근 게시물 호출 * * @desc 원래 /application/controllers/bbs.php > recently 를 curl을 이용해서 호출했는데, 웹소켓이 동시에 여러개 열리게됨에 따라 변경 * * @author KangMin * @since 2012.05.02 * * @param array * * @return array */ public function recently($req_bbs_ids) { //배열 아니거나 빈 배열이면 리턴 if (!is_array($req_bbs_ids) or count($req_bbs_ids) < 1) { return FALSE; } $CI =& get_instance(); $CI->load->model('bbs_model'); $bbs_idxs = array(); $bbs_ids = array(); //사용중이면서 존재하는지 $check_bbs_ids = $CI->bbs_model->check_bbs_ids($req_bbs_ids); foreach ($check_bbs_ids as $k => $v) { $bbs_ids[] = $v->bbs_id; $bbs_idxs[] = $v->idx; } //검증후에 다시 체크 if (count($bbs_idxs) < 1) { return FALSE; } //해당게시판들의 필요한 설정값 일괄 호출 $CI->load->model('bbs_setting_model'); //viewport $viewport_field = IS_MOBILE ? '' : '_pc'; $viewport = IS_MOBILE ? 'mobile' : 'pc'; $bbs_setting = $CI->bbs_setting_model->get_bbs_setting_section(array('bbs_recently_count' . $viewport_field, 'bbs_block_string_used', 'bbs_block_string', 'bbs_hour_new_icon_used_article', 'bbs_hour_new_icon_path_article', 'bbs_hour_new_icon_value_article', 'bbs_cut_length_recently' . $viewport_field, 'bbs_lists_style' . $viewport_field)); //설정값 배열 정리 $bbs_setting_temp = array(); foreach ($bbs_setting as $k => $v) { $bbs_setting_temp[$v->bbs_idx][$v->parameter] = $v->value; } $bbs_setting = $bbs_setting_temp; //캐싱 $CI->load->driver('cache'); $CI->load->model('bbs_article_model'); $CI->load->model('bbs_file_model'); $CI->load->helper('text'); //욕필터링때문에 $lastest_update_time = $CI->bbs_article_model->lastest_update_time(); foreach ($bbs_idxs as $k => $v) { $use_cache = FALSE; //캐쉬를 이용여부 //캐쉬 있으면 if ($CI->cache->file->get('recently_' . $v . '_' . $viewport)) { //캐쉬 생성시각 $cache_info = $CI->cache->file->get_metadata('recently_' . $v . '_' . $viewport); $cache_mtime = $cache_info['mtime']; //캐쉬타임이 DB 마지막 업데이트타임보다 작으면 쿼리실행, 아니면 캐쉬이용 if ($cache_mtime < $lastest_update_time) { $use_cache = FALSE; } else { $use_cache = TRUE; } } $use_cache = false; if ($use_cache == TRUE) { //데이터 $result[$bbs_ids[$k]] = $CI->cache->file->get('recently_' . $v . '_' . $viewport); } else { //갯수 $req_limit = (int) $bbs_setting[$v]['bbs_recently_count' . $viewport_field]; //욕필터링 $block_string = array(); if ($bbs_setting[$v]['bbs_block_string_used'] == 1) { $block_string = unserialize($bbs_setting[$v]['bbs_block_string']); } //게시판명 //글이 하나도 없으면 제목도 없어서 표출할 수 없다. $data['bbs_name'] = $CI->bbs_model->get_bbs_name($bbs_ids[$k]); $data['bbs_lists_style'] = $bbs_setting[$v]['bbs_lists_style' . $viewport_field]; //lists $data['lists'] = $CI->bbs_article_model->lists($v, 0, $req_limit, ' AND BBS_ARTICLE.is_deleted = 0 AND BBS_ARTICLE.is_secret = 0 ', FALSE, TRUE); //욕필터링과 다시 정리 $lists = array(); $cnt = 0; foreach ($data['lists'] as $k2 => $v2) { //새글 아이콘 $new_article_icon = ''; //사용여부 if ($bbs_setting[$v]['bbs_hour_new_icon_used_article'] == 1) { //파일 존재 //if(file_exists('.'.$bbs_setting[$v]['bbs_hour_new_icon_path_article'])) //{ //시간차 if ((int) $v2->timestamp_insert >= time() - (int) $bbs_setting[$v]['bbs_hour_new_icon_value_article'] * 60 * 60) { $new_article_icon = $bbs_setting[$v]['bbs_hour_new_icon_path_article']; } //} } $lists[$cnt]['idx'] = $v2->idx; $lists[$cnt]['bbs_id'] = $bbs_ids[$k]; $lists[$cnt]['bbs_name'] = $v2->bbs_name; $lists[$cnt]['category_name'] = $v2->category_name; $lists[$cnt]['name'] = name($v2->user_id, $v2->name, $v2->nickname); $lists[$cnt]['title'] = cut_string(word_censor($v2->title, $block_string), $bbs_setting[$v]['bbs_cut_length_recently' . $viewport_field]); $lists[$cnt]['comment_count'] = $v2->comment_count; $lists[$cnt]['vote_count'] = $v2->vote_count; $lists[$cnt]['scrap_count'] = $v2->scrap_count; $lists[$cnt]['timestamp'] = time2date($v2->timestamp_insert); $lists[$cnt]['is_notice'] = $v2->is_notice; $lists[$cnt]['hit'] = $v2->hit; $lists[$cnt]['new_article_icon'] = $new_article_icon; $image = $CI->bbs_file_model->get_image($v2->idx); if ($image) { $thumb_filepath = explode('.', $image[0]->conversion_filename); $thumb_filepath = $thumb_filepath[0] . '_thumb.' . $thumb_filepath[1]; if (file_exists($this->upload_path . $thumb_filepath)) { $v2->image = BASE_URL . $this->upload_path . $thumb_filepath; } else { if (file_exists($this->upload_path . $image[0]->conversion_filename)) { $v2->image = BASE_URL . $this->upload_path . $image[0]->conversion_filename; } else { $v2->image = FRONTEND . 'img/noimage.gif'; } } } else { $v2->image = FRONTEND . 'img/noimage.gif'; } $lists[$cnt]['image'] = $v2->image; $cnt++; } $data['lists'] = $lists; $result[$bbs_ids[$k]] = json_encode($data); //캐쉬저장 $CI->cache->file->save('recently_' . $v . '_' . $viewport, $result[$bbs_ids[$k]], 60 * 60 * 2); //2시간, 설정으로 뺄것까진 없을듯.. } } return $result; }
/** * 인덱스용 최근 하루한마디 * * @author KangMin * @since 2012.02.25 */ public function recently() { $data = NULL; $json = NULL; //원격호출 차단 //환경에 따라 문제가 될 수 있어서 뺌. 2012.05.02, KangMin //if($_SERVER['SERVER_ADDR'] !== $_SERVER['REMOTE_ADDR']) return FALSE; //갯수 //픽스, 악용하여 DB를 죽일수도 있어서... //관리자모드는 제공하지 않는 플러그인형태이므로 수작업.. $req_limit = $this->recently_limit; // ((int)$this->input->get_post('limit') > 0) ? (int)$this->input->get_post('limit') : 3; $this->load->helper('text'); //욕필터링때문에 //욕필터링 $data['block_string'] = $this->block_string; //lists $data['lists'] = $this->onedayonememo_model->lists(0, $req_limit, ' AND is_deleted = 0 '); //욕필터링과 다시 정리 $lists = array(); $cnt = 0; foreach ($data['lists'] as $k => $v) { //새글 아이콘 $new_article_icon = ''; //파일 존재 //if(file_exists('./IMAGEs/icon/new_article.gif')) //{ //시간차 //if( (int)$v->timestamp >= time() - (24*60*60) ) //24시간 if (date('Ymd', strtotime(time2date($v->timestamp))) == date('Ymd', strtotime(time2date(time())))) { $new_article_icon = FRONTEND_COMMON . '/img/icon/new_article.gif'; } //} $lists[$cnt]['idx'] = $v->idx; $lists[$cnt]['name'] = name($v->user_id, $v->name, $v->nickname); $lists[$cnt]['contents'] = cut_string(word_censor($v->contents, $data['block_string']), $this->cut_length_recently); $lists[$cnt]['timestamp'] = time2date($v->timestamp); $lists[$cnt]['new_article_icon'] = $new_article_icon; $cnt++; } $json['lists'] = $lists; echo json_encode($json); }
public function index() { $this->load->library('bbs_common'); //최근댓글 $this->load->model('bbs_comment_model'); //캐싱 $this->load->driver('cache'); $use_cache = FALSE; //캐쉬를 이용여부 //캐쉬 있으면 if ($this->cache->file->get('recently_comment_' . $this->viewport)) { //캐쉬 생성시각 $cache_info = $this->cache->file->get_metadata('recently_comment_' . $this->viewport); $cache_mtime = $cache_info['mtime']; //article, contents 중 큰 마지막 업데이트타임 //테이블 단위로 information_schema의 update_time 를 이용하므로 어느 한개던 실행되면 모두 적용되지만 뭐... $this->load->model('bbs_article_model'); $lastest_update_time = $this->bbs_article_model->lastest_update_time(); //원본글 삭제로 인한 시간도 잡아야하므로... //캐쉬타임이 DB 마지막 업데이트타임보다 작으면 쿼리실행, 아니면 캐쉬이용 if ($cache_mtime < $lastest_update_time) { $use_cache = FALSE; } else { $use_cache = TRUE; } } if ($use_cache == TRUE) { //데이터 $result = json_decode($this->cache->file->get('recently_comment_' . $this->viewport), TRUE); $recently_comment = $result['recently_comment']; $recently_comment_page = $result['recently_comment_page']; } else { $recently_comment = $this->bbs_comment_model->recently_comment((int) SETTING_recently_comment_count, ' AND BBS_COMMENT.is_deleted = 0 '); //댓글 페이지 계산 $recently_comment_page = array(); foreach ($recently_comment as $k => &$comment) { $new_comment_icon = ''; //파일 존재 if (file_exists('./' . SETTING_bbs_hour_new_icon_path_article)) { //시간차 if ((int) $comment['timestamp_insert'] >= time() - (int) SETTING_bbs_hour_new_icon_value_comment * 60 * 60) { $new_comment_icon = SETTING_bbs_hour_new_icon_path_article; } } $comment['comment'] = cut_string(trim(strip_tags(htmlspecialchars_decode($comment['comment']))), SETTING_cut_length_recently_comment); $comment['new_comment_icon'] = $new_comment_icon; $comment['print_name'] = name($comment['user_id'], $comment['name'], $comment['nickname']); $comment['print_date'] = time2date($comment['timestamp_insert']); //댓글 작성후 오른차순/내림차순 정렬에 따른 페이지로 보내기 if ($comment['bbs_comment_sort'] == 'ASC') { $comment_total_cnt = $this->bbs_comment_model->lists_total_cnt($comment['article_idx'], ' AND BBS_COMMENT.idx < ' . $comment['idx'] . ' AND BBS_COMMENT.is_deleted = 0 '); } else { $comment_total_cnt = $this->bbs_comment_model->lists_total_cnt($comment['article_idx'], ' AND BBS_COMMENT.idx > ' . $comment['idx'] . ' AND BBS_COMMENT.is_deleted = 0 '); } $recently_comment_page[$k] = floor($comment_total_cnt / $comment['bbs_count_list_comment']) + 1; } $result = json_encode(array('recently_comment' => $recently_comment, 'recently_comment_page' => $recently_comment_page)); //캐쉬저장 $this->cache->file->save('recently_comment_' . $this->viewport, $result, 60 * 60 * 2); //2시간, 설정으로 뺄것까진 없을듯.. } $recently_used = array(); $assign = array(); if (trim(SETTING_bbs_recently_used) !== '') { $recently_used = unserialize(SETTING_bbs_recently_used); } $recently = $this->bbs_common->recently($recently_used); foreach ($recently_used as $k => $v) { ${$v} = json_decode($recently[$v]); $assign[$v] = ${$v}->lists; $assign[$v . '_bbs_name'] = ${$v}->bbs_name; $assign[$v . '_bbs_lists_style'] = ${$v}->bbs_lists_style; } //$onedayonememo = json_decode($this->curl->simple_get('/plugin/onedayonememo/recently'), TRUE); //이건 플러그인 형태라서 그냥 curl로 간다. $onedayonememo = array('lists' => array()); $assign = array_merge($assign, array('onedayonememo' => $onedayonememo['lists'], 'recently_comment' => $recently_comment, 'recently_comment_page' => $recently_comment_page)); $this->scope('contents', 'contents/index', $assign); $this->display('layout'); }
)<br /> <?php echo lang('timestamp_post'); ?> : <?php echo $user_info->timestamp_post ? time2date($user_info->timestamp_post) : '-'; ?> (<?php echo $user_info->client_ip_post ? $user_info->client_ip_post : '-'; ?> )<br /> <?php echo lang('timestamp_update_password'); ?> : <?php echo $user_info->timestamp_update_password ? time2date($user_info->timestamp_update_password) : '-'; ?> (<?php echo $user_info->client_ip_update_password ? $user_info->client_ip_update_password : '******'; ?> ) </td> <tr> <th colspan = "2"><div align = "center"><input type = "submit" class = "button" value = "<?php echo lang('update'); ?> " /></div></th> </tr> </tbody> </table> </form>
<td onclick = "bbs_modify(<?php echo $v->idx; ?> );"><?php echo $v->comment_count; ?> </td> <td onclick = "bbs_modify(<?php echo $v->idx; ?> );"><?php echo name($v->user_id, $v->name, $v->nickname); ?> <br /> <?php echo time2date($v->timestamp_insert); ?> <br /> <?php echo $v->client_ip_insert; ?> </td> <td onclick = "bbs_modify(<?php echo $v->idx; ?> );"><?php echo $v->vote_count; ?> </td> <td onclick = "bbs_modify(<?php echo $v->idx;
$ip2db = custom_filter_input($_GET["ip2db"], FILTER_VALIDATE_IP); $orig_ip2db = $ip2db; $db2ip = custom_filter_input($_GET["db2ip"], FILTER_VALIDATE_STRING); $orig_db2ip = $db2ip; $time2date = custom_filter_input($_GET["time2date"], FILTER_VALIDATE_FLOAT); $orig_time2date = $time2date; $date2time = custom_filter_input($_GET["date2time"], FILTER_VALIDATE_STRING); $orig_date2time = $date2time; if (isset($ip2db)) { $ip2db = ip2db($ip2db); } if (isset($db2ip)) { $db2ip = db2ip($db2ip); } if (isset($time2date)) { $time2date = time2date($time2date); } if (isset($date2time)) { $date2time = date2time($date2time); } ?> <div class="row"> <div class="col-lg-12"> <h3>Tools</h3> </div> </div> <form action="tools.php" role="form" id="dashboard-generate" method="get" class="form-inline"> <div class="row">