本文整理汇总了PHP中display_username函数的典型用法代码示例。如果您正苦于以下问题:PHP display_username函数的具体用法?PHP display_username怎么用?PHP display_username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 관리자 메인 페이지입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_main_index';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$view['view']['latest_member'] = $this->Member_model->get_admin_list(7, '', '', '', 'mem_id', 'desc', '', '');
if (isset($view['view']['latest_member']['list']) && is_array($view['view']['latest_member']['list'])) {
foreach ($view['view']['latest_member']['list'] as $key => $val) {
$view['view']['latest_member']['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val));
}
}
$view['view']['latest_point'] = $this->Point_model->get_admin_list(7, '', '', '', 'poi_id', 'desc', '', '');
if (isset($view['view']['latest_point']['list']) && is_array($view['view']['latest_point']['list'])) {
foreach ($view['view']['latest_point']['list'] as $key => $val) {
$view['view']['latest_point']['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val));
}
}
$view['view']['latest_post'] = $this->Post_model->get_admin_list(7, '', '', '', 'post_id', 'desc', '', '');
if (isset($view['view']['latest_post']['list']) && is_array($view['view']['latest_post']['list'])) {
foreach ($view['view']['latest_post']['list'] as $key => $val) {
$brd_key = $this->board->item_id('brd_key', element('brd_id', $val));
$view['view']['latest_post']['list'][$key]['post_url'] = post_url($brd_key, element('post_id', $val));
$view['view']['latest_post']['list'][$key]['display_name'] = display_username(element('post_userid', $val), element('post_nickname', $val));
}
}
$view['view']['latest_comment'] = $this->Comment_model->get_admin_list(7, '', '', '', 'cmt_id', 'desc', '', '');
if (isset($view['view']['latest_comment']['list']) && is_array($view['view']['latest_comment']['list'])) {
foreach ($view['view']['latest_comment']['list'] as $key => $val) {
$post = $this->Post_model->get_one(element('post_id', $val), 'brd_id');
$brd_key = $this->board->item_id('brd_key', element('brd_id', $post));
$view['view']['latest_comment']['list'][$key]['post_url'] = post_url($brd_key, element('post_id', $val)) . '#comment_' . element('cmt_id', $val);
$view['view']['latest_comment']['list'][$key]['display_name'] = display_username(element('cmt_userid', $val), element('cmt_nickname', $val));
}
}
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'main');
$view['layout'] = $this->managelayout->admin($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));
}
示例2: htmlspecialchars
$x = "{$lab}/{$i}";
if (isset($citem[$x])) {
$citem[$x]++;
} else {
$citem[$x] = 1;
}
}
}
}
if (count($add) < $max) {
$add[] = htmlspecialchars($v);
}
}
$order['add'] = $add;
if ($order['uid']) {
$order['uname'] = display_username($order['uid']);
}
$list[] = $order;
}
$sl = '(' . _MD_SUM . ')';
foreach ($nitem as $k => $v) {
foreach (preg_grep('/^' . preg_quote($k . '/', '/') . '\\d+$/', array_keys($citem)) as $ki) {
unset($citem[$ki]);
}
if ($v !== "") {
$citem[$k . $sl] = $v;
}
}
$xoopsTpl->assign('list', $list);
$xoopsTpl->assign('confirm', $confirm);
ksort($citem);
示例3: eventform
function eventform($data, $uid)
{
global $xoopsUser, $xoopsModuleConfig;
$poster = $uid ? new XoopsUser($uid) : $xoopsUser;
$uid = is_object($poster) ? $poster->getVar('uid') : 0;
$myts =& MyTextSanitizer::getInstance();
if (empty($data['reservation'])) {
return null;
}
$form = array('uid' => $uid, 'poster' => $poster, 'uname' => display_username($uid));
$optfield = $data['optfield'];
// reservation form
if (isset($_POST['email'])) {
$email = $myts->stripSlashesGPC($_POST['email']);
} else {
$email = is_object($poster) ? $poster->email() : "";
}
$conf = isset($_POST['email_conf']) ? $myts->stripSlashesGPC($_POST['email_conf']) : $email;
$form['email'] = $myts->makeTboxData4Edit($email);
$form['email_conf'] = $myts->makeTboxData4Edit($conf);
$form['user_notify'] = $xoopsModuleConfig['user_notify'];
$form['check'] = array();
$mo = $xoopsModuleConfig['member_only'] != ACCEPT_EMAIL && is_object($poster);
$form['member_only'] = $mo;
if (!$mo) {
$form['check']['email'] = preg_replace('/\\*$/', '', _MD_EMAIL) . ": " . strip_tags(_MD_ORDER_NOTE1);
}
$items = array();
$field = 0;
$note1 = $note2 = "";
foreach (explode("\n", $optfield) as $n) {
$field++;
$n = rtrim($n);
if ($n == "") {
continue;
}
$attr = "";
$require = false;
if (preg_match('/^\\s*#/', $n)) {
$opts = preg_replace('/^\\s*#\\s*/', "", $n);
$type = "#";
$name = " ";
} else {
$opt = array();
$p = 0;
$len = strlen($n);
while ($p < $len) {
$w = '';
while ($p < $len) {
$c = $n[$p++];
if ($c == ',') {
break;
}
if ($c == '\\' && $p < $len) {
$c = $n[$p++];
if ($c == 'n') {
$c = "\n";
} elseif ($c != '\\' && $c != ',') {
$c = "\\{$c}";
}
}
$w .= $c;
}
$opt[] = $w;
}
$name = array_shift($opt);
if (preg_match('/[\\*#]$/', $name)) {
$require = true;
$attr = 'evms';
$note1 = _MD_ORDER_NOTE1;
}
if (preg_match('/^!/', $name)) {
$name = preg_replace('/^!/', '', $name);
$attr = 'evop';
$note2 = _MD_ORDER_NOTE2;
}
$v = "";
$type = "text";
$aname = isset($opt[0]) ? strtolower($opt[0]) : "";
switch ($aname) {
case "hidden":
case "const":
case "text":
case "checkbox":
case "radio":
case "textarea":
case "select":
$type = $aname;
array_shift($opt);
}
if ($type == 'hidden') {
continue;
}
$size = eguide_form_options('size', 60);
$cols = eguide_form_options('cols', 40);
$rows = eguide_form_options('rows', 5);
$opts = "";
$comment = "";
$fname = "opt{$field}";
$sub = 0;
//.........这里部分代码省略.........
示例4: display_name
/**
* converts a user object to a string representation of the user suitable for
* the current user (or specified user) to see
*
* Both parameters should be objects containing id, preferredname, firstname,
* lastname, admin
*
* @param mixed $user the user that you're trying to format to a string (accepts an integer, object, or array)
* @param object $userto the user that is looking at the string representation (if left
* blank, will default to the currently logged in user).
* @param boolean $nameonly do not append the user's username even if $userto can see it.
* @param boolean $realname show the user's real name even if preferredname exists
* @param boolean $username show the user's username even if the viewer is not an admin
*
* @returns string name to display
*/
function display_name($user, $userto = null, $nameonly = false, $realname = false, $username = false)
{
global $USER;
static $tutorcache = array();
if ($nameonly) {
return display_default_name($user);
}
$nousernames = get_config('nousernames');
$userto = get_user_for_display($userto);
$user = get_user_for_display($user);
$addusername = $username && empty($nousernames) || !empty($userto->admin) || !empty($userto->staff);
// if they don't have a preferred name set, just return here
if (empty($user->preferredname)) {
$firstlast = full_name($user);
if ($addusername) {
return $firstlast . ' (' . display_username($user) . ')';
}
return $firstlast;
} else {
if ($user->id == $userto->id) {
// If viewing our own name, show it how we like it
return $user->preferredname;
}
}
// Preferred name is set
$addrealname = $realname || !empty($userto->admin) || !empty($userto->staff);
if (!$addrealname) {
// Tutors can always see the user's real name, so we need to check if the
// viewer is a tutor of the user whose name is being displayed
if (!isset($tutorcache[$user->id][$userto->id])) {
$tutorcache[$user->id][$userto->id] = record_exists_sql('
SELECT s.member
FROM {group_member} s
JOIN {group_member} t ON s.group = t.group
JOIN {group} g ON (g.id = s.group AND g.deleted = 0 AND g.submittableto = 1)
JOIN {grouptype_roles} gtr
ON (g.grouptype = gtr.grouptype AND gtr.role = t.role AND gtr.see_submitted_views = 1)
WHERE s.member = ? AND t.member = ?', array($user->id, $userto->id));
}
$addrealname = $tutorcache[$user->id][$userto->id];
}
if ($addrealname) {
$firstlast = full_name($user);
if ($addusername) {
return $user->preferredname . ' (' . $firstlast . ' - ' . display_username($user) . ')';
}
return $user->preferredname . ' (' . $firstlast . ')';
}
if ($addusername) {
return $user->preferredname . ' (' . display_username($user) . ')';
}
return $user->preferredname;
}
示例5: lists
/**
* 댓글 목록을 ajax 로 가져옵니다
*/
public function lists($post_id = 0)
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_comment_list_lists';
$this->load->event($eventname);
$post_id = (int) $post_id;
if (empty($post_id) or $post_id < 1) {
show_404();
}
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
$post = $this->Post_model->get_one($post_id);
if (!element('post_id', $post)) {
show_404();
}
$board = $this->board->item_all(element('brd_id', $post));
$mem_id = (int) $this->member->item('mem_id');
$alertmessage = $this->member->is_member() ? '회원님은 이 댓글 목록을 볼 수 있는 권한이 없습니다' : '비회원은 이 댓글 접근할 권한이 없습니다.\\n\\n회원이시라면 로그인 후 이용해 보십시오';
$check = array('group_id' => element('bgr_id', $board), 'board_id' => element('brd_id', $board));
$this->accesslevel->check(element('access_view', $board), element('access_view_level', $board), element('access_view_group', $board), $alertmessage, $check);
$is_admin = $this->member->is_admin(array('board_id' => element('brd_id', $board), 'group_id' => element('bgr_id', $board)));
$check = array('group_id' => element('bgr_id', $board), 'board_id' => element('brd_id', $board));
$can_comment_write = $this->accesslevel->is_accessable(element('access_comment', $board), element('access_comment_level', $board), element('access_comment_group', $board), $check);
/**
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
*/
$param =& $this->querystring;
$findex = strtolower(element('comment_order', $board)) === 'desc' ? 'cmt_num, cmt_reply' : 'cmt_num desc, cmt_reply';
if ($this->cbconfig->get_device_view_type() === 'mobile') {
$per_page = element('mobile_comment_count', $board) ? (int) element('mobile_comment_count', $board) : 0;
} else {
$per_page = element('comment_count', $board) ? (int) element('comment_count', $board) : 0;
}
$page = (int) $this->input->get('page');
if (empty($page)) {
if (strtolower(element('comment_order', $board)) === 'desc') {
$page = 1;
} else {
$page = $per_page ? ceil(element('post_comment_count', $post) / $per_page) : 1;
if ($page === 0) {
$page = 1;
}
}
}
if ($page < 1) {
show_404();
}
$offset = ($page - 1) * $per_page;
$this->Comment_model->allow_search_field = array('cmt_id', 'post_id', 'cmt_content', 'cmt_userid', 'cmt_nickname');
// 검색이 가능한 필드
$this->Comment_model->search_field_equal = array('cmt_id', 'cmt_userid', 'cmt_nickname');
// 검색중 like 가 아닌 = 검색을 하는 필드
$image_width = $this->cbconfig->get_device_view_type() === 'mobile' ? element('post_mobile_image_width', $board) : element('post_image_width', $board);
$use_sideview = $this->cbconfig->get_device_view_type() === 'mobile' ? element('use_mobile_sideview', $board) : element('use_sideview', $board);
$comment_date_style = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_comment_date_style', $board) : element('comment_date_style', $board);
$comment_date_style_manual = $this->cbconfig->get_device_view_type() === 'mobile' ? element('mobile_comment_date_style_manual', $board) : element('comment_date_style_manual', $board);
// 이벤트가 존재하면 실행합니다
$view['view']['event']['step1'] = Events::trigger('step1', $eventname);
/**
* 게시판 목록에 필요한 정보를 가져옵니다.
*/
$where = array('post_id' => $post_id, 'cmt_del <>' => 2);
$result = $this->Comment_model->get_comment_list($per_page, $offset, $where, '', $findex, $sfield = '', $skeyword = '');
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
if (element('list', $result)) {
foreach (element('list', $result) as $key => $val) {
$result['list'][$key]['meta'] = $meta = $this->Comment_meta_model->get_all_meta(element('cmt_id', $val));
$result['list'][$key]['content'] = '';
$is_blind = element('comment_blame_blind_count', $board) > 0 && element('cmt_blame', $val) >= element('comment_blame_blind_count', $board) ? true : false;
if ($is_blind === true) {
$result['list'][$key]['content'] .= '<div class="alert alert-danger">신고가 접수된 게시글입니다. 본인과 관리자만 확인이 가능합니다</div>';
}
if (element('cmt_secret', $val)) {
$result['list'][$key]['content'] .= '<span class="label label-warning">비밀글입니다</span>';
}
if ($is_blind === false && !element('cmt_secret', $val) or $is_admin !== false or element('mem_id', $val) && (int) element('mem_id', $val) === $mem_id or element('mem_id', $post) && (int) element('mem_id', $post) === $mem_id) {
$result['list'][$key]['content'] .= display_html_content(element('cmt_content', $val), element('cmt_html', $val), $image_width, $autolink = true, $popup = true);
if (element('comment_syntax_highlighter', $board)) {
$result['list'][$key]['content'] = preg_replace_callback("/(\\[code\\]|\\[code=(.*)\\])(.*)\\[\\/code\\]/iUs", "content_syntaxhighlighter", $result['list'][$key]['content']);
// SyntaxHighlighter
}
}
if (element('cmt_del', $val)) {
$result['list'][$key]['content'] = '<div class="alert alert-danger">이 게시물은 ' . html_escape(element('delete_mem_nickname', $meta)) . '님에 의해 ' . html_escape(element('delete_datetime', $meta)) . ' 에 삭제 되었습니다</div>';
}
$result['list'][$key]['display_name'] = display_username(element('cmt_userid', $val), element('cmt_nickname', $val), element('mem_icon', $val), $use_sideview ? 'Y' : 'N');
$result['list'][$key]['display_datetime'] = display_datetime(element('cmt_datetime', $val), $comment_date_style, $comment_date_style_manual);
$result['list'][$key]['is_mobile'] = element('cmt_device', $val) === 'mobile' ? true : false;
$result['list'][$key]['display_ip'] = '';
if ($this->member->is_admin() === 'super' or element('show_comment_ip', $board) === '2') {
$result['list'][$key]['display_ip'] = display_ipaddress(element('cmt_ip', $val), '1111');
} elseif (element('show_comment_ip', $board) === '1') {
$result['list'][$key]['display_ip'] = display_ipaddress(element('cmt_ip', $val), $this->cbconfig->item('ip_display_style'));
}
$result['list'][$key]['member_photo_url'] = member_photo_url(element('mem_photo', $val), 64, 64) ? member_photo_url(element('mem_photo', $val), 64, 64) : site_url('assets/images/member_default.gif');
//.........这里部分代码省略.........
示例6: index
/**
* 검색 페이지 함수입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_search_index';
$this->load->event($eventname);
$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;
$findex = 'post_num, post_reply';
$sfield = $sfield2 = $this->input->get('sfield', null, '');
$sop = $this->input->get('sop', null, '');
if ($sfield === 'post_both') {
$sfield = array('post_title', 'post_content');
}
$mem_id = (int) $this->member->item('mem_id');
$skeyword = $this->input->get('skeyword', null, '');
if (empty($skeyword)) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_nokeyword_layout'] = Events::trigger('before_nokeyword_layout', $eventname);
/**
* 레이아웃을 정의합니다
*/
$page_title = $this->cbconfig->item('site_meta_title_search');
$meta_description = $this->cbconfig->item('site_meta_description_search');
$meta_keywords = $this->cbconfig->item('site_meta_keywords_search');
$meta_author = $this->cbconfig->item('site_meta_author_search');
$page_name = $this->cbconfig->item('site_page_name_search');
$layoutconfig = array('path' => 'search', 'layout' => 'layout', 'skin' => 'search', 'layout_dir' => $this->cbconfig->item('layout_search'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_search'), 'use_sidebar' => $this->cbconfig->item('sidebar_search'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_search'), 'skin_dir' => $this->cbconfig->item('skin_search'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_search'), '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));
return false;
}
/**
* 게시판 목록에 필요한 정보를 가져옵니다.
*/
$this->Post_model->allow_search_field = array('post_title', 'post_content', 'post_userid', 'post_nickname');
// 검색이 가능한 필드
$this->Post_model->search_field_equal = array('post_userid');
// 검색중 like 가 아닌 = 검색을 하는 필드
$per_page = 15;
$offset = ($page - 1) * $per_page;
$group_id = (int) $this->input->get('group_id') ? (int) $this->input->get('group_id') : '';
$board_id = (int) $this->input->get('board_id') ? (int) $this->input->get('board_id') : '';
$where = array();
$boardwhere = array('brd_search' => 1);
if ($group_id) {
$where['board.bgr_id'] = $group_id;
$boardwhere['board.bgr_id'] = $group_id;
}
$boardlisttmp = $this->Board_model->get_board_list($boardwhere);
$boardlist = array();
if (is_array($boardlisttmp)) {
foreach ($boardlisttmp as $key => $value) {
$boardlist[$value['brd_id']] = $value;
}
}
$grouplisttmp = $this->Board_group_model->get('', '', '', '', 0, 'bgr_order', 'ASC');
if (is_array($grouplisttmp)) {
foreach ($grouplisttmp as $key => $value) {
$grouplist[$value['bgr_id']] = $value;
}
}
$where['post.post_secret'] = 0;
$where['post.post_del'] = 0;
$like = '';
$result = $this->Post_model->get_search_list($per_page, $offset, $where, $like, $board_id, $findex, $sfield, $skeyword, $sop);
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
if (element('list', $result)) {
foreach (element('list', $result) as $key => $val) {
$images = '';
if (element('post_image', $val)) {
$imagewhere = array('post_id' => element('post_id', $val), 'pfi_is_image' => 1);
$images = $this->Post_file_model->get_one('', '', $imagewhere, '', '', 'pfi_id', 'ASC');
}
$result['list'][$key]['images'] = $images;
$result['list'][$key]['post_url'] = post_url(element('brd_key', $val), element('post_id', $val));
$result['list'][$key]['display_name'] = display_username(element('post_userid', $val), element('post_nickname', $val), element('mem_icon', $val), 'Y');
$result['list'][$key]['display_datetime'] = display_datetime(element('post_datetime', $val), 'user', 'Y-m-d H:i');
$result['list'][$key]['content'] = cut_str(strip_tags(element('post_content', $val)), 200);
$result['list'][$key]['is_mobile'] = element('post_device', $val) === 'mobile' ? true : false;
}
}
$view['view']['data'] = $result;
$view['view']['boardlist'] = $boardlist;
$view['view']['grouplist'] = $grouplist;
if (!$this->session->userdata('skeyword_' . urlencode($skeyword))) {
$sfieldarray = array('post_title', 'post_content', 'post_both');
if (in_array($sfield2, $sfieldarray)) {
$searchinsert = array('sek_keyword' => $skeyword, 'sek_datetime' => cdate('Y-m-d H:i:s'), 'sek_ip' => $this->input->ip_address(), 'mem_id' => $mem_id);
//.........这里部分代码省略.........
示例7: acceptfriend_form
$remoteusermessage = $record->message;
$remoteuseracceptform = acceptfriend_form($userid);
} else {
$relationship = 'none';
$friendscontrol = get_account_preference($userid, 'friendscontrol');
if ($friendscontrol == 'auto') {
$remoteusernewfriendform = addfriend_form($userid);
}
$remoteuserfriendscontrol = $friendscontrol;
}
}
}
$remoteuserrelationship = $relationship;
}
if ($userid != $USER->get('id') && $USER->is_admin_for_user($user) && is_null($USER->get('parentuser'))) {
$loginas = get_string('loginasuser', 'admin', display_username($user));
} else {
$loginas = null;
}
// Set up skin, if the page has one
$viewskin = $view->get('skin');
$owner = $view->get('owner');
$issiteview = $view->get('institution') == 'mahara';
if ($viewskin && get_config('skins') && can_use_skins($owner, false, $issiteview) && (!isset($THEME->skins) || $THEME->skins !== false)) {
$skin = array('skinid' => $viewskin, 'viewid' => $view->get('id'));
$skindata = unserialize(get_field('skin', 'viewskin', 'id', $viewskin));
} else {
$skin = false;
}
$smarty = smarty($javascript, $stylesheets, array(), array('sidebars' => false, 'skin' => $skin));
$smarty->assign('restrictedview', $restrictedview);
示例8: followedlist
/**
* 마이페이지>팔로우(Followed) 입니다
*/
public function followedlist()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_mypage_followedlist';
$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->model('Follow_model');
/**
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
*/
$param =& $this->querystring;
$page = (int) $this->input->get('page') > 0 ? (int) $this->input->get('page') : 1;
$findex = $this->Follow_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('follow.target_mem_id' => $mem_id);
$result = $this->Follow_model->get_followed_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) {
$result['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val), element('mem_icon', $val));
$result['list'][$key]['num'] = $list_num--;
}
}
$view['view']['data'] = $result;
$view['view']['followed_total_rows'] = $result['total_rows'];
$countwhere = array('mem_id' => $mem_id);
$view['view']['following_total_rows'] = $this->Follow_model->count_by($countwhere);
/**
* 페이지네이션을 생성합니다
*/
$config['base_url'] = site_url('mypage/followedlist') . '?' . $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_followedlist');
$meta_description = $this->cbconfig->item('site_meta_description_mypage_followedlist');
$meta_keywords = $this->cbconfig->item('site_meta_keywords_mypage_followedlist');
$meta_author = $this->cbconfig->item('site_meta_author_mypage_followedlist');
$page_name = $this->cbconfig->item('site_page_name_mypage_followedlist');
$layoutconfig = array('path' => 'mypage', 'layout' => 'layout', 'skin' => 'followedlist', '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));
}
示例9: elseif
} elseif ($action == 'details') {
$logid = $_GET['id'];
if (empty($logid) or !is_numeric($logid) or !log_get($logid)) {
header('Location: index.php?module=logs');
die;
} else {
$log = log_get($logid);
$userip = long2ip($log->userIP);
if (!empty($log->userHost)) {
$userip .= " (" . $log->userHost . ")";
}
// End if(!empty)
$content .= "<h2>" . lang("Details for logentry ") . " #" . $logid . "</h2>";
$content .= "<a href='javascript:history.back()'>Back</a>";
$content .= "<table>";
$content .= "<tr class='logrow1'><th>" . lang("User", "logs") . "</th><td>" . display_username($log->userID) . "</td></tr>";
$content .= "<tr class='logrow2'><th>" . lang("Timestamp", "logs") . "</th><td>" . $log->logTime . "</td></tr>";
$content .= "<tr class='logrow1'><th>" . lang("IP", "logs") . " / " . lang("Host", "logs") . "</th><td>" . $userip . "</td></tr>";
$content .= "<tr class='logrow2'><th>" . lang("URL", "logs") . "</th><td>" . $log->logURL . "</td></tr>";
$content .= "<tr class='logrow1'><th>" . lang("Logmodule", "logs") . "</th><td>" . $log->logModule . "</td></tr>";
$content .= "<tr class='logrow2'><th>" . lang("Logfunction", "logs") . "</th><td>" . $log->logFunction . "</td></tr>";
$content .= "</table>";
$content .= "<table><tr><td>";
if (!empty($log->logTextNew) && $log->logTextNew != NULL) {
$logNew = unserialize($log->logTextNew);
$row = 1;
$content .= "<table>";
if (!empty($logNew)) {
foreach ($logNew as $type => $value) {
$content .= "<tr class='logrow{$row}'><th>" . $type . "</th><td>" . htmlentities($value) . "</th></tr>";
$row++;
示例10: index
/**
* 목록을 가져오는 메소드입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_member_members_index';
$this->load->event($eventname);
$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;
$view['view']['sort'] = array('mem_id' => $param->sort('mem_id', 'asc'), 'mem_userid' => $param->sort('mem_userid', 'asc'), 'mem_username' => $param->sort('mem_username', 'asc'), 'mem_nickname' => $param->sort('mem_nickname', 'asc'), 'mem_email' => $param->sort('mem_email', 'asc'), 'mem_point' => $param->sort('mem_point', 'asc'), 'mem_register_datetime' => $param->sort('mem_register_datetime', 'asc'), 'mem_lastlogin_datetime' => $param->sort('mem_lastlogin_datetime', 'asc'), 'mem_level' => $param->sort('mem_level', 'asc'));
$findex = $this->input->get('findex', null, 'member.mem_id');
$forder = $this->input->get('forder', null, 'desc');
$sfield = $this->input->get('sfield', null, '');
$skeyword = $this->input->get('skeyword', null, '');
$per_page = admin_listnum();
$offset = ($page - 1) * $per_page;
/**
* 게시판 목록에 필요한 정보를 가져옵니다.
*/
$this->{$this->modelname}->allow_search_field = array('mem_id', 'mem_userid', 'mem_email', 'mem_username', 'mem_nickname', 'mem_level', 'mem_homepage', 'mem_register_datetime', 'mem_register_ip', 'mem_lastlogin_datetime', 'mem_lastlogin_ip', 'mem_is_admin');
// 검색이 가능한 필드
$this->{$this->modelname}->search_field_equal = array('mem_id', 'mem_level', 'mem_is_admin');
// 검색중 like 가 아닌 = 검색을 하는 필드
$this->{$this->modelname}->allow_order_field = array('member.mem_id', 'mem_userid', 'mem_username', 'mem_nickname', 'mem_email', 'mem_point', 'mem_register_datetime', 'mem_lastlogin_datetime', 'mem_level');
// 정렬이 가능한 필드
$where = array();
if ($this->input->get('mem_is_admin')) {
$where['mem_is_admin'] = 1;
}
if ($this->input->get('mem_denied')) {
$where['mem_denied'] = 1;
}
if ($mgr_id = (int) $this->input->get('mgr_id')) {
if ($mgr_id > 0) {
$where['mgr_id'] = $mgr_id;
}
}
$result = $this->{$this->modelname}->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
if (element('list', $result)) {
foreach (element('list', $result) as $key => $val) {
$result['list'][$key]['mem_denied_text'] = $this->member_denied[$result['list'][$key]['mem_denied']];
$result['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val), element('mem_icon', $val));
$result['list'][$key]['meta'] = $this->Member_meta_model->get_all_meta(element('mem_id', $val));
$result['list'][$key]['num'] = $list_num--;
}
}
$view['view']['data'] = $result;
/**
* primary key 정보를 저장합니다
*/
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
/**
* 페이지네이션을 생성합니다
*/
$config['base_url'] = admin_url($this->pagedir) . '?' . $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;
/**
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
*/
$search_option = array('mem_userid' => '회원아이디', 'mem_email' => '이메일', 'mem_username' => '회원명', 'mem_nickname' => '닉네임', 'mem_level' => '회원레벨', 'mem_homepage' => '홈페이지', 'mem_register_datetime' => '회원가입날짜', 'mem_register_ip' => '회원가입IP', 'mem_lastlogin_datetime' => '최종로그인날짜', 'mem_lastlogin_ip' => '최종로그인IP', 'mem_adminmemo' => '관리자메모');
$view['view']['skeyword'] = $sfield && array_key_exists($sfield, $search_option) ? $skeyword : '';
$view['view']['search_option'] = search_option($search_option, $sfield);
$view['view']['listall_url'] = admin_url($this->pagedir);
$view['view']['write_url'] = admin_url($this->pagedir . '/write');
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/listdelete/?' . $param->output());
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
$view['layout'] = $this->managelayout->admin($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));
}
示例11: index
/**
* 목록을 가져오는 메소드입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_stat_currentvisitor_index';
$this->load->event($eventname);
$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;
$view['view']['sort'] = array('cur_ip' => $param->sort('cur_ip', 'asc'), 'cur_datetime' => $param->sort('cur_datetime', 'asc'), 'cur_page' => $param->sort('cur_page', 'asc'), 'cur_url' => $param->sort('cur_url', 'asc'), 'cur_referer' => $param->sort('cur_referer', 'asc'));
$findex = $this->input->get('findex', null, 'cur_datetime');
$forder = $this->input->get('forder', null, 'desc');
$sfield = $this->input->get('sfield', null, '');
$skeyword = $this->input->get('skeyword', null, '');
$per_page = 100;
$offset = ($page - 1) * $per_page;
$minute = (int) $this->cbconfig->item('currentvisitor_minute');
if ($minute < 1) {
$minute = 10;
}
$curdatetime = cdate('Y-m-d H:i:s', ctimestamp() - $minute * 60);
$cachename = 'delete_old_currentvisitor_cache';
$cachetime = 60;
if (!($result = $this->cache->get($cachename))) {
$deletewhere = array('cur_datetime < ' => $curdatetime);
$this->Currentvisitor_model->delete_where($deletewhere);
$this->cache->save($cachename, cdate('Y-m-d H:i:s'), $cachetime);
}
/**
* 게시판 목록에 필요한 정보를 가져옵니다.
*/
$this->{$this->modelname}->allow_search_field = array('cur_ip', 'cur_mem_name', 'cur_datetime', 'cur_page', 'cur_url', 'cur_referer', 'cur_useragent', 'currentvisitor.mem_id');
// 검색이 가능한 필드
$this->{$this->modelname}->search_field_equal = array('currentvisitor.mem_id');
// 검색중 like 가 아닌 = 검색을 하는 필드
$this->{$this->modelname}->allow_order_field = array('cur_ip', 'cur_datetime', 'cur_page', 'cur_url', 'cur_referer');
// 정렬이 가능한 필드
$where = array('cur_datetime >' => $curdatetime);
$result = $this->{$this->modelname}->get_admin_list($per_page, $offset, $where, '', $findex, $forder, $sfield, $skeyword);
$list_num = $result['total_rows'] - ($page - 1) * $per_page;
if (element('list', $result)) {
foreach (element('list', $result) as $key => $val) {
$result['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val), element('mem_icon', $val));
if (element('cur_useragent', $val)) {
$userAgent = get_useragent_info(element('cur_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;
/**
* primary key 정보를 저장합니다
*/
$view['view']['primary_key'] = $this->{$this->modelname}->primary_key;
/**
* 페이지네이션을 생성합니다
*/
$config['base_url'] = admin_url($this->pagedir) . '?' . $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;
/**
* 쓰기 주소, 삭제 주소등 필요한 주소를 구합니다
*/
$search_option = array('cur_ip' => '아이피', 'cur_datetime' => '날짜', 'cur_page' => '페이지이름', 'cur_url' => '현재주소', 'cur_referer' => '이전주소', 'cur_useragent' => '운영체제/브라우저');
$view['view']['skeyword'] = $sfield && array_key_exists($sfield, $search_option) ? $skeyword : '';
$view['view']['search_option'] = search_option($search_option, $sfield);
$view['view']['listall_url'] = admin_url($this->pagedir);
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'index');
$view['layout'] = $this->managelayout->admin($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));
}
示例12: write_admin
/**
* 그룹관리자를 관리하는 페이지입니다
*/
public function write_admin($pid = 0)
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_admin_board_boardgroup_write_admin';
$this->load->event($eventname);
$view = array();
$view['view'] = array();
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before'] = Events::trigger('before', $eventname);
/**
* 프라이머리키에 숫자형이 입력되지 않으면 에러처리합니다
*/
$pid = (int) $pid;
if (empty($pid) or $pid < 1) {
show_404();
}
/**
* Validation 라이브러리를 가져옵니다
*/
$this->load->library('form_validation');
/**
* 전송된 데이터의 유효성을 체크합니다
*/
$config = array(array('field' => 'bgr_id', 'label' => '그룹아이디', 'rules' => 'trim|required|numeric|is_natural'), array('field' => 'userid', 'label' => '회원아이디', 'rules' => 'trim|required|alpha_dash|min_length[3]|max_length[50]|callback__userid_check[' . $pid . ']'));
$this->form_validation->set_rules($config);
/**
* 유효성 검사를 하지 않는 경우, 또는 유효성 검사에 실패한 경우입니다.
* 즉 글쓰기나 수정 페이지를 보고 있는 경우입니다
*/
if ($this->form_validation->run() === false) {
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formrunfalse'] = Events::trigger('formrunfalse', $eventname);
} else {
/**
* 유효성 검사를 통과한 경우입니다.
* 즉 데이터의 insert 나 update 의 process 처리가 필요한 상황입니다
*/
// 이벤트가 존재하면 실행합니다
$view['view']['event']['formruntrue'] = Events::trigger('formruntrue', $eventname);
$memdata = $this->Member_model->get_by_userid($this->input->post('userid'), 'mem_id');
$mem_id = element('mem_id', $memdata);
$insertdata = array('bgr_id' => $this->input->post('bgr_id'), 'mem_id' => $mem_id);
$this->Board_group_admin_model->insert($insertdata);
}
/**
* 페이지에 숫자가 아닌 문자가 입력되거나 1보다 작은 숫자가 입력되면 에러 페이지를 보여줍니다.
*/
$param =& $this->querystring;
$findex = $this->input->get('findex') ? $this->input->get('findex') : $this->Board_group_admin_model->primary_key;
$forder = $this->input->get('forder', null, 'desc');
$getdata = $this->{$this->modelname}->get_one($pid);
$where = array('bgr_id' => $pid);
$result = $this->Board_group_admin_model->get('', '', $where, '', '', $findex, $forder);
if ($result && is_array($result)) {
foreach ($result as $key => $val) {
$select = 'mem_id, mem_userid, mem_nickname, mem_email, mem_icon';
$result[$key]['member'] = $dbmember = $this->Member_model->get_by_memid(element('mem_id', $val), $select);
$result[$key]['display_name'] = display_username(element('mem_userid', $dbmember), element('mem_nickname', $dbmember), element('mem_icon', $dbmember));
}
}
$view['view']['list'] = $result;
$view['view']['data'] = $getdata;
$primary_key = $this->Board_group_admin_model->primary_key;
$view['view']['list_delete_url'] = admin_url($this->pagedir . '/write_admin_delete/' . $pid . '?' . $param->output());
$view['view']['primary_key'] = $primary_key;
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 어드민 레이아웃을 정의합니다
*/
$layoutconfig = array('layout' => 'layout', 'skin' => 'write_admin');
$view['layout'] = $this->managelayout->admin($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));
}
示例13: while
while (isset($sheets[$tab]) && count($sheets[$tab]['rows']) >= $max_sect) {
$n++;
$tab = formatTimestamp($edate, 'md') . "({$n})";
}
if (empty($sheets[$tab])) {
$day = formatTimestamp($edate, 'Y-m-d');
$sheets[$tab] = array('title' => $data['title'], 'edate' => $day, 'rows' => array());
}
$res = $xoopsDB->query("SELECT * FROM " . RVTBL . " WHERE eid={$eid} AND status=" . _RVSTAT_RESERVED . " AND exid=" . (empty($data['exid']) ? 0 : $data['exid']));
$rows = array();
$member_handler =& xoops_gethandler('member');
while ($rvdata = $xoopsDB->fetchArray($res)) {
$row = unserialize_text($rvdata['info']);
$row[_MD_ORDER_DATE] = formatTimestamp($rvdata['rdate'], 'Y-m-d H:i:s');
$row[_MD_EMAIL] = $rvdata['email'];
$row[_MD_UNAME] = display_username($rvdata['uid']);
$row[_MD_RVID] = $rvdata['rvid'];
$vals = array();
foreach ($outs as $k) {
$v = empty($k) || empty($row[$k]) ? "" : $row[$k];
$type = preg_match('/^-?\\d+$/', $v) ? "Number" : "String";
$vals[] = array('value' => $v, 'type' => $type);
}
while (count($vals) < $nfield) {
// padding blanks
$vals[] = $nbsp;
}
$rows[] = $vals;
}
while (count($rows) < $max_rows) {
// minimum line padding
示例14: activitylistout_html
//.........这里部分代码省略.........
$records = array();
$msgidquery .= "\n ORDER BY ctime DESC";
$msgidrecords = get_records_sql_array($msgidquery, array($userid, $userid), $offset, $limit);
if (!is_array($msgidrecords)) {
$msgidrecords = array();
}
foreach ($msgidrecords as $msgidrecord) {
if ($msgidrecord->msgtable == 'notification_internal_activity') {
$recordsarray = get_records_sql_array("SELECT a.*, at.name AS type, at.plugintype, at.pluginname\n FROM {notification_internal_activity} a\n INNER JOIN {activity_type} at ON a.type = at.id\n WHERE a.id = ?", array($msgidrecord->id));
if (1 !== count($recordsarray)) {
log_warn('inconsistent message-id in notification_internal_activity, id: ' . $msgidrecord->id);
continue;
}
$record = $recordsarray[0];
$record->self = false;
$record->canreplyall = false;
$record->canreply = false;
$record->startnewthread = true;
// read out receiver name
if (isset($record->usr)) {
$tousrarray = array('display' => display_name($record->usr), 'link' => null);
if (!get_user($record->usr)->deleted) {
$tousrarray['link'] = profile_url($record->usr);
$record->canreply = true;
}
$record->tousr = array($tousrarray);
$record->self = $record->from == $USER->get('id');
} else {
$record->tousr = array(array('display' => get_string('system'), 'link' => null));
$record->self = true;
}
// read out sender name
if (isset($record->from)) {
$record->fromusr = $record->from;
} else {
// we're in the outbox, so basically, this should hold for all messages
$record->fromusr = $USER->get('id');
}
$record->date = format_date(strtotime($record->ctime), 'strfdaymonthyearshort');
$section = empty($record->plugintype) ? 'activity' : "{$record->plugintype}.{$record->pluginname}";
$record->strtype = get_string('type' . $record->type, $section);
$record->message = format_notification_whitespace($record->message);
// used to identify notification as internal for json-calls
$record->table = 'notification_internal_activity';
$records[] = $record;
} else {
if ($msgidrecord->msgtable === 'module_multirecipient_notification') {
$record = get_message_mr($userid, $msgidrecord->id);
if (null === $record) {
continue;
}
$record->strtype = $record->type;
$record->date = format_date(strtotime($record->ctime), 'strfdaymonthyearshort');
// We fill $record->tousr with an array per userentry, that holds the
// display name of the user and the link to the users profile, if
// applicable - we don't link to deleted users. Those will be summed
// up in a single entry at the end of the list
$deletedcount = 0;
$record->self = false;
$record->canreply = false;
$record->canreplyall = false;
$record->startnewthread = false;
for ($i = 0; $i < count($record->userids); $i++) {
$tousr = get_user($record->userids[$i]);
if ($tousr->deleted) {
$deletedcount++;
} else {
$record->tousr[] = array('username' => display_username(get_user_for_display($record->userids[$i])), 'display' => display_name($record->userids[$i]), 'link' => profile_url($record->userids[$i]));
}
}
if ($deletedcount > 0) {
$record->tousr[] = array('username' => $deletedcount . ' ' . get_string('deleteduser', 'module.multirecipientnotification'), 'display' => $deletedcount . ' ' . get_string('deleteduser', 'module.multirecipientnotification'), 'link' => null);
}
if ($deletedcount < count($record->userids)) {
if (count($record->userids) - $deletedcount == 1) {
$record->canreply = true;
$record->self = $record->fromid == $USER->get('id');
} else {
$record->canreplyall = true;
}
}
if (isset($record->fromid)) {
$record->fromusr = $record->fromid;
} else {
$record->fromusr = 0;
}
$record->message = format_notification_whitespace($record->message);
// used to identify notification as from this plugin for json-calls
$record->table = 'module_multirecipient_notification';
$records[] = $record;
}
}
}
$smarty = smarty_core();
$smarty->assign('data', $records);
$smarty->assign('USER', $USER);
$smarty->assign('maxnamestrlength', PluginModuleMultirecipientnotification::MAX_USERNAME_IN_LIST_LENGTH);
$result['html'] = $smarty->fetch('module:multirecipientnotification:activitylistout.tpl');
return $result;
}
示例15: index
/**
* 현재접속자 페이지입니다
*/
public function index()
{
// 이벤트 라이브러리를 로딩합니다
$eventname = 'event_currentvisitor_index';
$this->load->event($eventname);
if (!$this->cbconfig->item('open_currentvisitor') && $this->member->is_admin() === false) {
alert('이 웹사이트는 현재접속자 기능을 사용하지 않습니다');
}
$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;
$per_page = 100;
$offset = ($page - 1) * $per_page;
$minute = (int) $this->cbconfig->item('currentvisitor_minute');
if ($minute < 1) {
$minute = 10;
}
$curdatetime = cdate('Y-m-d H:i:s', ctimestamp() - $minute * 60);
$cachename = 'delete_old_currentvisitor_cache';
$cachetime = 60;
if (!($result = $this->cache->get($cachename))) {
$deletewhere = array('cur_datetime < ' => $curdatetime);
$this->Currentvisitor_model->delete_where($deletewhere);
$this->cache->save($cachename, cdate('Y-m-d H:i:s'), $cachetime);
}
$result = $this->Currentvisitor_model->get_current_list($curdatetime, $per_page, $offset);
$list_num = ($page - 1) * $per_page + 1;
$visitor = array();
if (element('list', $result)) {
foreach (element('list', $result) as $key => $value) {
$data = $value;
if (element('mem_userid', $value)) {
$data['name_or_ip'] = display_username(element('mem_userid', $value), element('mem_nickname', $value), element('mem_icon', $value));
} else {
$ip_display_style = $this->member->is_admin() === 'super' ? '1111' : $this->cbconfig->item('ip_display_style');
$data['name_or_ip'] = display_ipaddress(element('cur_ip', $value), $ip_display_style);
}
$data['num'] = $list_num++;
$visitor[] = $data;
}
}
$view['view']['list'] = $visitor;
$view['view']['total_rows'] = $result['total_rows'];
/**
* 페이지네이션을 생성합니다
*/
$config['base_url'] = site_url('currentvisitor') . '?' . $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']['canonical'] = site_url('currentvisitor');
// 이벤트가 존재하면 실행합니다
$view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
/**
* 레이아웃을 정의합니다
*/
$page_title = $this->cbconfig->item('site_meta_title_currentvisitor');
$meta_description = $this->cbconfig->item('site_meta_description_currentvisitor');
$meta_keywords = $this->cbconfig->item('site_meta_keywords_currentvisitor');
$meta_author = $this->cbconfig->item('site_meta_author_currentvisitor');
$page_name = $this->cbconfig->item('site_page_name_currentvisitor');
$searchconfig = array('{현재접속자수}');
$replaceconfig = array($result['total_rows']);
$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' => 'currentvisitor', 'layout' => 'layout', 'skin' => 'currentvisitor', 'layout_dir' => $this->cbconfig->item('layout_currentvisitor'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_currentvisitor'), 'use_sidebar' => $this->cbconfig->item('sidebar_currentvisitor'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_currentvisitor'), 'skin_dir' => $this->cbconfig->item('skin_currentvisitor'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_currentvisitor'), '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));
}